For Package Development

First step

The first step that needs to be taken, is cloning Laravel. Go to your code directory and run git clone git@github.com:laravel/laravel.git. Your workbench directory will now be called laravel. The location of my workbench is ~/Server/laravel.

Packages folder

Within your workbench you need a directory for your packages. We are going to use this directory to autoload the packages you are creating. For your package you can create directories with the following structure: packages/[Vendor]/[Package]/src. This could result in packages/Captain/Awesome/src.

Composer.json

Navigate to you package (packages/Captain/Awesome/src) and run composer init. …


CLI Commands on Steroids

Aliases

  • alias art='php artisan'


How do View Composers work?

View Composer are created within a Service Provider, and best practice is to create a dedicated Service Provider, called ComposerServiceProvider. Within the boot method, call this code to register a simple View Composer.

view()->composer('header', function ($view) {
$view->with([
'message' => 'This is a message on some page'
]);
});

Gijs Jorissen

Web Developer. ❤ Laravel, Wordpress, Vue.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store