Adds an artisan aliases
command to Laravel 4 that lists registered
aliases and the classes they map to, including resolving facades.
This saves you having to look them up, and works with custom aliases and facades as well. It's also easier than calling getFacadeRoot() manually and gives you more detail about the class hierarchy.
composer require davejamesmiller/laravel-aliases dev-master
This will update composer.json
and install it into the vendor/
directory.
Note: dev-master
is the latest development version.
See the Packagist website for a list of other versions.
'providers' => array(
// ...
'DaveJamesMiller\Aliases\AliasesServiceProvider',
),
This registers the Artisan task with Laravel.
$ php artisan aliases
e.g.
App
-> Illuminate\Support\Facades\App
-> Illuminate\Foundation\Application
-> Illuminate\Container\Container
Artisan
-> Illuminate\Support\Facades\Artisan
-> Illuminate\Console\Application
-> Symfony\Component\Console\Application
...
$ php artisan aliases re
e.g.
Redirect
-> Illuminate\Support\Facades\Redirect
-> Illuminate\Routing\Redirector
Redis
-> Illuminate\Support\Facades\Redis
-> Illuminate\Redis\Database
Request
-> CustomRequest
-> Illuminate\Support\Facades\Request
-> Illuminate\Http\Request
-> Symfony\Component\HttpFoundation\Request
Response
-> Illuminate\Support\Facades\Response
$ php artisan aliases -v re
e.g.
Redirect
alias > Illuminate\Support\Facades\Redirect
facade > App::make('redirect')
resolve > Illuminate\Routing\Redirector
Redis
alias > Illuminate\Support\Facades\Redis
facade > App::make('redis')
resolve > Illuminate\Redis\Database
Request
alias > CustomRequest
parent > Illuminate\Support\Facades\Request
facade > App::make('request')
resolve > Illuminate\Http\Request
parent > Symfony\Component\HttpFoundation\Request
Response
alias > Illuminate\Support\Facades\Response
- Initial release
- Show how facades are resolved when using verbose (
-v
) flag (e.g.App::make('url')
)
Version bump - no changes.
- Compatibility with Laravel 4.1.
- Compatibility with Laravel 5.4.
I got the idea from this Fideloper blog post, and worked out how to implement it by looking at this phpDoc generator by barryvdh.
MIT License. See LICENSE.txt.