Download the PHP package sawmainek/laravel-api-generator without Composer

On this page you can find all versions of the php package sawmainek/laravel-api-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-api-generator

Laravel API/Scaffold/CRUD Generator

Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License

Version Compability

Laravel Branch
5.0 1.3
5.1.* 1.4
5.2.* master

I enjoy creating API's and I have worked on many projects that required them. But the problem I always faced was setting up all the boilerplate code. For example each end point needs a migration, model, controller, repository, and on and on. I wanted a way to streamline this process and that is how this package was born.

This API generator allows you to use artisan commands to automatically generate all these files saving you time. Not only does it auto generate the files but it will set the namespaces.

The artisan command can generate the following items:

And your simple CRUD and APIs are ready in mere seconds.

Here is the full documentation.

Upgrade Guide.

Documentation is in process...

Documentation

  1. Installation
  2. Configuration
  3. Publish & Initialization
  4. Generator
  5. Supported Field Types
  6. Customization
    1. Base Controller
    2. Customize Templates
    3. Dingo API Integration
  7. Options
    1. Paginate Records
    2. Model Soft Deletes
    3. Fields From File
    4. Custom Table Name
    5. Skip Migration
    6. Remember Token
  8. Generator from existing tables

NOTE

Make sure if install auth "make:auth"

Installation

  1. Add this package to your composer.json:

    "require": {
        "laracasts/flash": "~1.3",
        "laravelcollective/html": "5.2.*",
        "bosnadev/repositories": "dev-master",
        "sawmainek/laravel-api-generator": "dev-master"
    }
  2. Run composer update

    composer update
  3. Add the ServiceProviders to the providers array in .
    As we are using these two packages laravelcollective/html & laracasts/flash as a dependency.
    so we need to add those ServiceProviders as well.

    Collective\Html\HtmlServiceProvider::class,
    Laracasts\Flash\FlashServiceProvider::class,
    Mitul\Generator\GeneratorServiceProvider::class,

    Also for convenience, add these facades in alias array in .

    'Form'      => Collective\Html\FormFacade::class,
    'Html'      => Collective\Html\HtmlFacade::class,
    'Flash'     => Laracasts\Flash\Flash::class

Configuration

Publish Configuration file .

    php artisan vendor:publish --provider="Mitul\Generator\GeneratorServiceProvider"

Config file () contains path for all generated files

Publish & Initialization

Mainly, we need to do three basic things to get started.

  1. Publish some common views like & .
  2. Publish which will contain all our api routes.
  3. Init for api routes. We need to include into main .

    php artisan mitul.generator:publish

Generator

Fire artisan command to generate API, Scaffold with CRUD views or both API as well as CRUD views.

Generate API:

    php artisan mitul.generator:api ModelName

Generate CRUD Scaffold:

    php artisan mitul.generator:scaffold ModelName

Generate CRUD Scaffold with API:

    php artisan mitul.generator:scaffold_api ModelName

e.g.

php artisan mitul.generator:api Project
php artisan mitul.generator:api Post

php artisan mitul.generator:scaffold Project
php artisan mitul.generator:scaffold Post

php artisan mitul.generator:scaffold_api Project
php artisan mitul.generator:scaffold_api Post

Here is the sample fields input json

Supported HTML Field Types

Here is the list of supported field types with options:

Customization

Base Controller

If you want to use your own base controller or want to extend/modify default AppBaseController then you can have following options:

  1. If you want to use another controller (recommended to extends AppBaseController with new controller) as base controller then modify value in

  2. If you want to modify AppBaseController then,

    1. Publish AppBaseController in your controllers path

      php artisan mitul.generator:publish --baseController

    2. Modify the content of and set it as a in

Customize Templates

To use your own custom templates,

  1. Publish templates to

    php artisan mitul.generator:publish --templates
  2. Leave only those templates that you want to change. Remove the templates that do not plan to change.

Options

Paginate Records

To paginate records, you can specify paginate option, e.g.

    php artisan mitul.generator:api Post --paginate=10

Model Soft Deletes

To use SoftDelete, use softDelete option,

    php artisan mitul.generator:api Post --softDelete

Fields From File

If you want to pass fields from file then you can create fields json file and pass it via command line. Here is the sample fields.json

You have to pass option with command. e.g.

     php artisan mitul.generator:scaffold_api Post --fieldsFile="/Users/Mitul/laravel-api-generator/fields.json"
     php artisan mitul.generator:scaffold_api Post --fieldsFile="fields.json"

Custom Table Name

You can also specify your own custom table name by,

    php artisan mitul.generator:api Post --tableName=custom_table_name

Skip Migration

You can also skip migration generation,

    php artisan mitul.generator:api Post --skipMigration

Remember Token

To generate rememberToken field in migration file,

    php artisan mitul.generator:api Post --rememberToken

Generator from existing tables

To use generator with existing table, you can specify option. option is required and you need to specify table name.

Just make sure, you have installed package.

Limitation: As of now it is not fully working (work is in progress). It will not create migration file. You need to tweak some of the things in your generated files like timestamps, primary key etc.

    php artisan mitul.generator:api Post --fromTable --tableName=posts

Credits

This API Generator is created by Mitul Golakiya.

Bugs & Forks are welcomed :)


All versions of laravel-api-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/html Version ~5.0
laracasts/flash Version ~1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sawmainek/laravel-api-generator contains the following files

Loading the files please wait ....