banner



How To Register A Service Provider For Lumen ?

Weblog about making a service provider for lumen

New Project

          {
"name": "etiennemarais/outline-laravel",
"description": "Service provider for outline test generator",
"type": "library",
"license": "GPL-3.0",
"crave": {
"etiennemarais/outline": "~0.2"
},
"authors": [
{
"name": "Etienne Marais",
"email": "hello@etiennemarais.co.za"
}
],
"autoload": {
"psr-4": {
"OutlineLaravel\\": "src/OutlineLaravel/"
}
},
"minimum-stability": "dev"
}

What I needed

          outline:regenerate        

The Command

                      <?php
namespace
OutlineLaravel\Commands;

utilize DrafterPhp\Drafter;
use Illuminate\Panel\Command;
use Outline\ApiBlueprint\ApiBlueprint;
employ Outline\Test\Generator\Generator;
utilise Outline\Transformer\Outline\Transformer;

class Regenerate extends Command
{
protected $proper noun = 'outline:regenerate';
protected $clarification = 'Regenerate feature tests from the api blueprint specification';
private $apiBlueprintFile;

public role __construct()
{
parent::__construct();
$this->apiBlueprintFile = base_path() . '/apiary.apib';
}

public function handle()
{
$this->info("Regenerating feature tests from your apiary doc: \n{$this->apiBlueprintFile}");

$drafter = new Drafter(base_path() . '/vendor/bin/drafter');

$apiBlueprint = new ApiBlueprint($drafter, $this->apiBlueprintFile);

(new Generator(new Transformer))
->with($apiBlueprint)
->outputTo(base_path() . '/tests/Features')
->generateTestsFor('lumen');
}
}

ServiceProvider (The glue)

                      <?php
namespace
OutlineLaravel;

use Illuminate\Support\ServiceProvider;

class OutlineLaravelServiceProvider extends ServiceProvider
{
public office boot()
{
$this->app['outline:regenerate'] =
$this->app->share(function () {
return new Commands\Regenerate();
});

$this->commands(
'outline:regenerate'
);
}

/**
* Annals the service provider.
*
*
@return void
*/
public function register()
{
// Goose egg to register
}
}

          $this->app['outline:regenerate']        
          php artisan        

How To Register A Service Provider For Lumen ?,

Source: https://medium.com/@etbal/blog-about-making-a-service-provider-for-lumen-561715a1c047

Posted by: clementsenty1997.blogspot.com

0 Response to "How To Register A Service Provider For Lumen ?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel