Download the PHP package wn/lumen-generators without Composer

On this page you can find all versions of the php package wn/lumen-generators. 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 lumen-generators

Lumen generators

Build Status Scrutinizer Code Quality SensioLabsInsight License

A collection of generators for Lumen and Laravel 5.

Contents

Why ?

I installed Lumen and wanted to use it to create a REST API (since this is the main usage of Lumen). But I didn't find commands which will speed up my workflow. That's why I created this package and included useful commands to build a RESTful API.

This packages was mainly built to be used with Lumen, but it should work fine with Laravel 5 too.

Installation

Add the generators package to your composer.json by running the command:

composer require wn/lumen-generators

Then add the service provider in the file app/Providers/AppServiceProvider.phplike the following:

Don't forget to include the application service provider on your bootstrap/app.php and to enable Eloquent and Facades if you are using Lumen

If you run the command php artisan list you will see the list of added commands:

Quick Usage

To generate a RESTful resource for your application (model, migration, controller and RESTful routes), you simply need to run one single command. For example:

will generate these files:

app/Task.php

app/Http/Controllers/RESTActions.php

app/Http/Controllers/TasksController.php

app/Http/routes.php

database/migrations/date_time_create_tasks.php

Now simply run the migration and you are ready to go.

More then that, you can generate multiple resources with only one command ! Click here to see an example

Detailed Usage

Model Generator

The wn:model command is used to generate a model class based on Eloquent. It has the following syntax:

php artisan wn:model Task generates the following:

php artisan wn:model Task --fillable=name,title gives:

php artisan wn:model Task --dates=started_at,published_at gives:

php artisan wn:model Task --path="app/Http/Models" gives:

gives:

gives:

Migration Generator

The wn:migration command is used to generate a migration to create a table with schema. It has the following syntax:

gives:

gives:

Pivot Table Generator

The wn:pivot-table command is used to generate a migration to create a pivot table between two models. It has the following syntax:

gives:

Controller Generator

There are two commands for controllers. The first one is wn:controller:rest-actions which generates a trait used by all generated controllers. This trait includes the following methods:

Note that the trait doesn't use the common used methods on Laravel (like index, store, ...) to avoid conflicts. Which enables you to use this trait with controllers you already have in your application.

The second command is wn:controller which actually generates the controller. The syntax of this command is wn:controller model [--no-routes] [--force=true].

php artisan wn:controller Task --no-routes gives:

Routes Generator

The wn:route command is used to generate RESTfull routes for a controller. It has the following syntax:

wn:route resource [--controller=...] [--force=true]

php artisan wn:route project-type adds the following routes:

php artisan wn:route project-type --laravel adds the following routes:

Resource Generator

The wn:resource command makes it very easy to generate a RESTful resource. It generates a model, migration, controller and routes. The syntax is : wn:resource name fields [--add=...] [--has-many=...] [--has-one=...] [--belongs-to=...] [--migration-file=...] [--path=...] [--force=true]

Multiple Resources From File

The wn:resources (note the "s" in "resources") command takes the generation process to an other level by parsing a file and generating multiple resources based on it. The syntax is

This generator is smart enough to add foreign keys automatically when finding a belongsTo relation. It also generates pivot tables for belongsToMany relations automatically.

The file given to the command should be a valid YAML file ( for the moment, support of other types like XML or JSON could be added in the future). An example is the following:

Testing

To test the generators, I included a fresh lumen installation under the folder lumen-test to which I added this package and have written some acceptance tests using Codeception. To run tests you just have to execute the install.sh to install dependencies then execute test.sh.

Development Notes

Contributing

Pull requests are welcome :D


All versions of lumen-generators with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
illuminate/console Version ^5.1
illuminate/filesystem Version ^5.1
fzaninotto/faker Version ^1.5
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 wn/lumen-generators contains the following files

Loading the files please wait ....