New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

lukaskorl/apigen

Scaffolds restful APIs in Laravel 4
52 3

Larablocks Analysis

lukaskorl/apigen works with Laravel 4 (latest release v0.3, Jun 4, 2014), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 4, past end of life
  • No release in the last 12 months (last: Jun 4, 2014)
  • 0 downloads a month (needs 10,000)
  • 3 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Jun 4, 2014.
  • No releases in the last 12 months.
  • First released: Jun 4, 2014.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.

Install
composer require lukaskorl/apigen
Latest Version:v0.3
PHP:>=5.4.0
Laravel:4
Last Updated:Jun 19, 2014
Links: GitHub  ·  Packagist
Maintainer: lukaskorl

API Generator for Laravel 4

APIgen scaffolds restful APIs for you. If you choose to APIgen also sets you up with an administration interface.

Be aware: APIgen is currently under heavy development. I strongly advise against using the current version of APIgen in a production environment. I'm working on getting APIgen to a stable release as soon as possible.

Installation

composer require lukaskorl/apigen
php artisan apigen:publish

Add the apigen:publish command to the post-*-cmd scripts of your project's composer.json like so:

"scripts": {
	"post-install-cmd": [
		"php artisan clear-compiled",
		"php artisan optimize",
        "php artisan apigen:publish"
	],
	"post-update-cmd": [
		"php artisan clear-compiled",
		"php artisan optimize",
        "php artisan apigen:publish"
	],
	"post-create-project-cmd": [
		"php artisan key:generate"
	]
},

Usage

Note on namespace

By default APIgen uses the namespace Api. You need to register this namespace for autoloading in your composer.json file if you don't use your own namespace. To register the Api namespace merge this snippet into your composer.json file:

{
    "autoload": {
        "psr-4": {
            "Api\\": "app/Api"
        }
    }
}

Generating a resources

When generating a resource APIgen will generate for you:

To create a new resource simply run an Artisan command:

php artisan apigen:resource dog --fields="name:string, age:integer"

Optionally you can specify a namespace by adding the --namespace option:

php artisan apigen:resource dog --fields="name:string, age:integer" --namespace="Zoo\Animals"

There are switches to skip some generators:

  • --no-admin Prevents the setup of the administration backend.
  • --no-route Prevents adding the route to the application's routes.php file.
  • --no-controller Prevents the generation of the API controller. So you can selectively create the migration, model and repository only. Beware that if no controller is generated also the route setup is skipped.
  • --no-migration Prevents the generation of the migration file if you decide to set it up manually.

Generating a repository

When generating a repository APIgen will generate for you:

  • Interface for your repository: Implementing your repository against an interface makes it easily possible to switch out implementations.
  • Transformer for your entities: A transformer filters the output before sending an entity to the client. So you have granularly control the visibility, aliases and types of entity attributes in the response.
  • Eloquent CRUD implementation of your repository: The default implementation of the generated repository uses Eloquent to access the database layer.

Generating a model

APIgen can generate will generate an Eloquent model for you.

Setting up an administration backend

APIgen ships out of the box with support for FrozenNode/Laravel-Administrator. However APIgen uses a more advanced fork lukaskorl/administrator.

Contributions

Making changes to JavaScript & CSS

JavaScript and CSS files are pre-compiled using gulp. If you make changes to the source you will need to recompile them. The gulp tasks are all set-up. Make sure you have gulp and bower.io installed.

npm install -g bower
bower install

npm install gulp -g
npm install gulp gulp-util --save-dev
gem install sass
npm install gulp-ruby-sass gulp-autoprefixer gulp-minify-css gulp-notify gulp-rename gulp-cache gulp-concat gulp-coffee gulp-plumber gulp-uglify --save-dev

If you have the necessary software installed execute the gulp tasks to build the JS & CSS

gulp build

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
v0.3 >=5.4.0 4.2.*
v0.2 >=5.4.0 4.2.*
v0.1 >=5.3.0 4.1.*