PHPackages                             mckenziearts/laravel-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mckenziearts/laravel-command

ActiveLaravel-package[Utility &amp; Helpers](/categories/utility)

mckenziearts/laravel-command
============================

A simple Laravel package to provide artisan new commands

1.0.1(7y ago)321.2k2MITPHPPHP &gt;=5.5.0

Since May 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mckenziearts/laravel-command)[ Packagist](https://packagist.org/packages/mckenziearts/laravel-command)[ Docs](https://github.com/Mckenziearts/laravel-command)[ RSS](/packages/mckenziearts-laravel-command/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Laravel-command
===============

[](#laravel-command)

[![Latest Stable Version](https://camo.githubusercontent.com/af380d2afc122f3f932165ae7902419f5fd0f96909f3718729f9d1ff25feeda0/68747470733a2f2f706f7365722e707567782e6f72672f6d636b656e7a6965617274732f6c61726176656c2d636f6d6d616e642f76657273696f6e)](https://packagist.org/packages/mckenziearts/laravel-command)[![License](https://camo.githubusercontent.com/036af4a7d0870296e58b70d8beab8b2b4cb49721dedb75d8d5d29abe1d5df80b/68747470733a2f2f706f7365722e707567782e6f72672f6d636b656e7a6965617274732f6c61726176656c2d636f6d6d616e642f6c6963656e7365)](https://packagist.org/packages/mckenziearts/laravel-command)[![Build Status](https://camo.githubusercontent.com/e88216b6e44613f8ecc48746c7f074ffffaddbc362dbbb2036311e720758712c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d636b656e7a6965617274732f6c61726176656c2d636f6d6d616e642f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Mckenziearts/laravel-command/build-status)[![Total Downloads](https://camo.githubusercontent.com/ec6ed02f33a44619f129db7ac021d282f7f75b4fa4ef9ba835a6d093d7bde92f/68747470733a2f2f706f7365722e707567782e6f72672f6d636b656e7a6965617274732f6c61726176656c2d636f6d6d616e642f646f776e6c6f616473)](https://packagist.org/packages/mckenziearts/laravel-command)

Simple package to quickly generate Laravel templated Repository, Helpers and Observer files.

Install
-------

[](#install)

Via Composer

```
$ composer require mckenziearts/laravel-command --dev
```

For Laravel 5.5 - you're done.

For Laravel 5.4 or 5.3 you'll only want to use these commands for `local` development, so you don't want to update the `production` providers array in `config/app.php`. Instead, add the provider in `app/Providers/AppServiceProvider.php`, like so:

```
public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register('Mckenziearts\LaravelCommand\LaravelCommandServiceProvider');
    }
}
```

Usage
-----

[](#usage)

By default Laravel does not allow to generate observers or even does not allow to take the notion of repository as Symfony. To generate its elements you can use the following commands

Open the console and enter this command to generate a new repository :

```
php artisan make:repository {Entity}
```

The generate file look like this :

```
namespace App\Repositories;

use App\Models\Entity;

class EntityRepository
{
    /**
     * @var Entity
     */
    private $model;

    /**
     * EntityRepository constructor.
     * @param Entity $model
     */
    public function __construct(Entity $model)
    {
        $this->model = $model;
    }

    /**
     * Return a new instance of Entity Model
     *
     * @return Entity
     */
    public function newInstance()
    {
        return $this->model->newInstance();
    }
}
```

By default Repository load Model in the default application namespace `App\Models` If your models are in another namespace, it will be necessary to change the use in the repository to have no error like :

```
use MODELS\NAMESPACE\Entity;
```

This is the same action to perform for the observers, it also loads the models in the namespace App\\Models. To generate an observer, you must execute the command:

```
php artisan make:observer {Entity}
```

The generate file look like this :

```
namespace App\Observers;

use App\Models\Entity;

class EntityObserver
{
    /**
     * Trigger Before Create a Entity
     *
     * @param Entity $model
     */
    public function creating(Entity $model){}

    /**
     * Trigger after create a Entity
     *
     * @param Entity $model
     */
    public function created(Entity $model){}

    /**
     * Trigger before update a Entity
     *
     * @param Entity $model
     */
    public function updating(Entity $model){}

    ...
}
```

- Helper files

```
$ php artisan make:helper {Entity}
```

The generate file look like this :

```
namespace App\Helpers;

class EntityHelper
{

}
```

If you need better distribut your code, you can create a helper to put a logic to lighten your controllers.

An example of a helper that I often use in my projects

```
namespace App\Helpers;

use Intervention\Image\Facades\Image;

class MediaHelper
{
    /**
     * @protected
     *
     * @var string $dir, the file uploaded path
     */
    protected static $dir = 'uploads';

    /**
     * @return string
     */
    public static function getUploadsFolder()
    {
        return self::$dir;
    }

    /**
     * Return the size of an image
     *
     * @param string $file
     * @param string $folder
     * @return array $width and $height of the file give in parameter
     */
    public static function getFileSizes(string $file, string $folder = null)
    {
        if ($folder) {
            list($width, $height, $type, $attr) = getimagesize(public_path(self::$dir.'/'. $folder .'/'.$file));
        }
        list($width, $height, $type, $attr) = getimagesize(public_path(self::$dir.'/'.$file));

        return [
            'width'     => $width,
            'height'    => $height
        ];
    }

    /**
     * resize, To rezise and image
     *
     * @param string    $file      file to rezise
     * @param int       $width     width of the file
     * @param int       $height    height of the file
     * @param string    $filepath  path to save file
     */
    public static function resize($file, $width, $height, $filepath)
    {
        Image::make($file)->resize($width, $height)->save($filepath);
    }

    /**
     * getImageWeight
     *
     * @param $octets
     * @return string
     */
    public static function getImageWeight($octets) {
        $resultat = $octets;
        for ($i = 0; $i < 8 && $resultat >= 1024; $i++) {
            $resultat = $resultat / 1024;
        }
        if ($i > 0) {
            return preg_replace('/,00$/', '', number_format($resultat, 2, ',', ''))
                . ' ' . substr('KMGTPEZY', $i-1, 1) . 'o';
        } else {
            return $resultat . ' o';
        }
    }

}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2902d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14105989?v=4)[Arthur Monney](/maintainers/Mckenziearts)[@mckenziearts](https://github.com/mckenziearts)

---

Top Contributors

[![mckenziearts](https://avatars.githubusercontent.com/u/14105989?v=4)](https://github.com/mckenziearts "mckenziearts (42 commits)")

---

Tags

artisan-commandlaravelphplaravelhelperobservergeneratorsrepositoryartisan-cli

### Embed Badge

![Health badge](/badges/mckenziearts-laravel-command/health.svg)

```
[![Health](https://phpackages.com/badges/mckenziearts-laravel-command/health.svg)](https://phpackages.com/packages/mckenziearts-laravel-command)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M682](/packages/barryvdh-laravel-ide-helper)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
