toanna/saf-laravel-toolkit

A development toolkit for SAF's Laravel Developers

v1.3.4 2019-10-08 07:28 UTC

This package is auto-updated.

Last update: 2024-04-08 18:22:00 UTC


README

A development toolkit for SAF's Laravel Developer

Get started

$ composer require toanna/saf-laravel-toolkit

Commands

Initialize folder structure

$ php artisan saf:init

Folder structure:

/app
    /Abstraction
        /ExternalServiceInterface
        /RepositoryInterface
    /Business
    /BusinessService
    /Common
        /CircuitBreaker
        /DomainModels
        /Exceptions
        /ExternalConfig
        /Logging
    /Dependency
        /ExternalServices
        /Repositories
    /Providers
    /Representation
        /Console
        /Http
            /Controllers
                /Api
                /Auth
            /Middleware
            /Requests
            Kernel.php

Initialize git hooks

After connect with your remote, run this to setup:

$ php artisan saf:git-hooks-init

Creating Commands

Create an Abstraction Interface to app/Abstraction/:

$ php artisan saf:abstraction ExternalServiceInterface/IFileUploader

Create a Business Logic Class to app/Business/:

$ php artisan saf:business CreateFileBL

Create a Business Service Class to app/BusinessService/:

$ php artisan saf:business_service CreateFileBS

Create a Controller Class to app/Representation/Http/:

$ php artisan saf:controller TestController

Create an API Controller Class to app/Representation/Http/Api:

$ php artisan saf:api_controller FileController

Create a Dependency Class to app/Dependency/:

$ php artisan saf:dependency Repositories/SQLFileCreator

Create a Domain Model Class to app/Common/DomainModels:

$ php artisan saf:domain_model File

Create an Eloquent ORM Class to app/Dependency/Repositories/Eloquent/:

$ php artisan saf:eloquent FileEloquent

Create an Exception Class to app/Common/Exceptions/:

$ php artisan saf:exception ValidationException

Create a Form Request Class to app/Representation/Http/Requests/:

$ php artisan saf:request CreateFileRequest

Create a Resource to app/Representation/Http/Resources/:

$ php artisan saf:resource

Create a Artisan Command to app/Representation/Console/Commands/:

$ php artisan saf:console AbstractionMakeCommand

Common Libraries

Elastic Logger

Example in app/config/logging.php:

'stack' => [
    'driver' => 'stack',
    'channels' => ['daily', 'elastic'],
],

'elastic' => [
    'driver' => 'custom',
    'via' => Toanna\SAFLaravelToolkit\Common\Logging\ElasticLogger::class,
    'host' => 'localhost',
    'port' => 9200,
    'level' => 'debug'
],

Contributors