Skip to content

Instantly share code, notes, and snippets.

@Lelectrolux
Last active August 16, 2016 23:09
Show Gist options
  • Save Lelectrolux/67d9ea453833ccd94af24f3dd7b3f6d4 to your computer and use it in GitHub Desktop.
Save Lelectrolux/67d9ea453833ccd94af24f3dd7b3f6d4 to your computer and use it in GitHub Desktop.
Collection of packages to start a fresh install of Laravel 5

Collection of package to speed up L5 dev

Contents

Necessary packages

###barryvdh/laravel-ide-helper

Allows IDE to understand Laravel 5 special syntax (facade, factories, etc.). Really needed.

Composer :

composer require barryvdh/laravel-ide-helper

In config\app.php :

'providers' => [
    // ...
    Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
    // ...
],

Artisan :

php artisan ide-helper:generate
php artisan ide-helper:meta

php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider"

In composer.json :

"scripts":{
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan ide-helper:generate",
        "php artisan ide-helper:meta",
        "php artisan optimize"
    ]
},

Adds a debugbar with each response giving informations and debug capabilities. I'm pretty sure it will be usefull at one point.

Composer :

composer require barryvdh/laravel-debugbar

In config\app.php :

'providers' => [
    // ...
    Barryvdh\Debugbar\ServiceProvider::class,
    // ...
],
'aliases' => [
    // ...
    'Debugbar' => Barryvdh\Debugbar\Facade::class,
    // ...
],

Artisan :

php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"

Adds lots of details to error pages. You do need this ! No discussions

Composer :

composer require filp/whoops

In app/Exceptions/Handler.php :

/**
 * Create a Symfony response for the given exception.
 *
 * @param  \Exception  $e
 * @return mixed
 */
protected function convertExceptionToResponse(Exception $e)
{
    if (config('app.debug')) {
        $whoops = new \Whoops\Run;
        if(request()->wantsJson())
        {
            $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler());
        }
        else
        {
            $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
        }

        return response()->make(
            $whoops->handleException($e),
            method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500,
            method_exists($e, 'getHeaders') ? $e->getHeaders() : []
        );
    }

    return parent::convertExceptionToResponse($e);
}

Usually usefull packages

Easy creation of slugs for your Eloquent models in Laravel 5.

Composer :

composer require cviebrock/eloquent-sluggable

In config/app.php :

'providers' => [
    // ...
    Cviebrock\EloquentSluggable\ServiceProvider::class,
    // ...
],

Artisan :

php artisan vendor:publish --provider="Cviebrock\EloquentSluggable\ServiceProvider"

Usage :

use Cviebrock\EloquentSluggable\Sluggable;

class Book extends Eloquent
{
    use Sluggable;
    
    protected $fillable = ['title'];
    
    public function sluggable() {
        return [
            'slug' => [
                'source' => ['author.name', 'title']
            ]
        ];
    }
    
    public function author() {
        return $this->belongsTo(Author::class);
    }
}

Allows you to write email stylesheets or style tags, and inlines it automatically.

Composer :

composer require fedeisas/laravel-mail-css-inliner

In config\app.php :

'providers' => [
    // ...
    Fedeisas\LaravelMailCssInliner\LaravelMailCssInlinerServiceProvider::class,
    // ...
],

Artisan :

php artisan vendor:publish --provider='Fedeisas\\LaravelMailCssInliner\\LaravelMailCssInlinerServiceProvider'

This date library extends Carbon with multi-language support.

Composer :

composer require jenssegers/date

In config\app.php :

'providers' => [
    // ...
    Jenssegers\Date\DateServiceProvider::class,
    // ...
],
'aliases' => [
    // ...
    'Date' => Jenssegers\Date\Date::class,
    // ...
],

Easy Flash Messages for Your Laravel App

Composer :

composer require laracasts/flash

In config\app.php:

'providers' => [
    // ...
    Laracasts\Flash\FlashServiceProvider::class,
    // ...
],

Transform PHP Vars to JavaScript easily.

Composer :

composer require laracasts/utilities

In config\app.php :

'providers' => [
    // ...
    Laracasts\Utilities\JavaScript\JavaScriptServiceProvider::class,
    // ...
],

Artisan :

php artisan vendor:publish --provider='Laracasts\\Utilities\\JavaScript\\\JavaScriptServiceProvider'

HTML and Form Builders for the Laravel Framework

Composer :

composer require laravelcollective/html

In config\app.php :

'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
],
'aliases' => [
    // ...
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
    // ...
],

Laravel Excel brings the power of PHPOffice's PHPExcel to Laravel 5 with a touch of the Laravel Magic.


Needs laravelcollective/bus if Laravel >= 5.2

Composer :

composer require laravelcollective/bus

In config\app.php :

'providers' => [
    // ...
    Collective\Bus\BusServiceProvider::class,
    // ...
],

Composer :

composer require maatwebsite/excel

In config\app.php :

'providers' => [
    // ...
    Maatwebsite\Excel\ExcelServiceProvider::class,
    // ...
],
'aliases' => [
    // ...
    'Excel' => Maatwebsite\Excel\Facades\Excel::class,
    // ...
],

Artisan :

php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"

This package introduces a new preview mail driver for laravel, when selected it will produce the content of the sent mail and save it as .html & .eml documents.

Composer :

composer require themsaid/laravel-mail-preview

In config\app.php :

'providers' => [
    // ...
    Themsaid\MailPreview\MailPreviewServiceProvider::class
    // ...
],

Artisan :

php artisan vendor:publish --provider="Themsaid\MailPreview\MailPreviewServiceProvider"

In .env :

MAIL_DRIVER=preview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment