Encapsulate communication of services.
!!! At this time the package is still in developmental stage and should not be used in production.
Require this package with composer:
composer require per3evere/preq --dev
Add ServiceProvider
add this to the providers array in config/app.php
Per3evere\Preq\PreqServiceProvider::classadd this in bootstrap/app.php
$app->register(Per3evere\Preq\PreqServiceProvider::class);Create service command file
namespace App\Services;
use Per3evere\Preq\AbstractCommand;
class Example extends AbstractCommand
{
/**
* 执行命令
*
* @return void
*/
public function run()
{
return 'run!';
}
}execute it
$command = app('preq')->getCommand(\App\Services\Example::class);
echo $command->execute();