for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ElfSundae\Laravel\Apps;
use Illuminate\Support\ServiceProvider;
use Laravel\Lumen\Application as LumenApplication;
class AppsServiceProvider extends ServiceProvider
{
/**
* Bootstrap the service provider.
*
* @return void
*/
public function boot()
$this->macroUrlGenerator();
if ($this->app->runningInConsole()) {
$this->publishAssets();
}
* Register macros for UrlGenerator.
protected function macroUrlGenerator()
$this->app['url']->macro('getRootControllerNamespace', function () {
return $this->rootNamespace;
rootNamespace
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
});
* Publish assets from package.
protected function publishAssets()
$this->publishes([
__DIR__.'/../config/apps.php' => base_path('config/apps.php'),
], 'laravel-apps');
* Register the service provider.
public function register()
$this->setupAssets();
$this->app->singleton('apps', function ($app) {
return new Apps($app);
$this->app->alias('apps', Apps::class);
* Setup package assets.
protected function setupAssets()
if ($this->app instanceof LumenApplication) {
$this->app->configure('apps'); // @codeCoverageIgnore
$this->mergeConfigFrom(__DIR__.'/../config/apps.php', 'apps');
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: