Skip to content

A Laravel package with collection of helpful extra artisan console development commands and helpers.

License

Notifications You must be signed in to change notification settings

jimmerioles/Laravel-Dev-Extras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Dev Extras

Packagist Travis branch GitHub commits Packagist license

This Laravel package provide artisan developers with useful developement commands and helpers that are not included in Laravel by default.

Installation

To get the latest version of Laravel Dev Extras, simply require the project using Composer:

$ composer require --dev jim-merioles/laravel-dev-extras

Once installed, you need to register the service provider. Open up config/app.php and add the following to the providers key:

/*
 * Package Service Providers...
 */
JimMerioles\LaravelDevExtras\LaravelDevExtrasServiceProvider::class,

Features:

Repository Make Command:

Generates a repository class for a model.

Scenario:

Most of the time our code screams for a better architecture, and often we want our models to adhere to Repository Design Pattern for some reasons; for better integration with caching and other stuffs.

Usage:

$ php artisan make:repository FooRepository
Creates:
<?php

namespace App\Repositories;

class FooRepository
{
    /**
     * Create a new repository instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }
}
Model Option

Automatic model scaffold within the repository class.

$ php artisan make:repository FooRepository --model=Foo
Creates:
<?php

namespace App\Repositories;

use Foo;

class FooRepository
{
    /**
     * Foo model instance.
     *
     * @var Foo
     */
    protected $foo;

    /**
     * Create a new repository instance.
     *
     * @param Foo $foo
     */
    public function __construct(Foo $foo)
    {
        $this->foo = $foo;

        //
    }
}

Database Listener Helper:

Alias for:

DB::listen(function ($event) {
    dump($event->sql);
    dump($event->bindings);
    dump($event->time);
});

Scenario:

Most of the time when tinkering with your database and eloquent models using $ php artisan tinker, you might want to listen for and dump sql queries, bindings and execution time to inspect or even just to verify if your cache works when no query has been made.

Usage:

Psy Shell v0.7.2 (PHP 7.0.11-1+deb.sury.org~trusty+1 — cli) by Justin Hileman
>>> db() // dumps queries, bindings, and execution time

Contributing

Very open for suggestions and request. Please request an issue or by pull requests.

Security Vulnerabilities

If you discover a security vulnerability, please send an e-mail to Jim Merioles at jimwisleymerioles@gmail.com. All security vulnerabilities will be promptly addressed.

License

Laravel Dev Extras is open-sourced software licensed under the MIT license.

About

A Laravel package with collection of helpful extra artisan console development commands and helpers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages