Code Monkey home page Code Monkey logo

laravel-service-maker's Introduction

Laravel Service Maker

Total Downloads Latest Stable Version License

What does it do?

This package adds a new php artisan make:service {name} {--N|noContract} command. It will create a service file and its contract (interface) for saving time while working with Laravel Framework and benefit from the Service Pattern.

Installation

You can install the package via composer:

composer require nordcoders/laravel-service-maker --dev

How does it work?

After installation, the command php artisan make:service {name} {--N|noContract} will be available.

Create services files

For example, the command php artisan make:service createUser will generate a service file called CreateUserService.php located in app/Services/CreateUser.

It will also generate an interface (contract) called CreateUserContract.php located in app/Services/Contracts.

Create services for models

Adding a --service or -S option is now available when creating a model.

For example, the command php artisan make:model Book --service or php artisan make:model Book -S will generate a model with service too.

The command php artisan make:model Book --all or php artisan make:model Book -a will now generate a model, migration, factory, seeder, policy, controller, form requests and service.

Contracts

Adding a --noContract or -N option will prevent the commands from implementing any contract and will not create any contract file.

If you never need any contracts. Publish the config file and then turn the with_interface value to false in the config file.

Configuration file

You can publish the config file with:

php artisan vendor:publish --tag="service-maker-config"

This is the content of the published config file:

return [
    'with_interface' => true,
];

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-service-maker's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar ludoguenet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.