PHPackages                             lukaskorl/apigen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. lukaskorl/apigen

ActiveLibrary[API Development](/categories/api)

lukaskorl/apigen
================

Scaffolds restful APIs in Laravel 4

v0.3(12y ago)352PHPPHP &gt;=5.4.0

Since Jun 4Pushed 12y ago1 watchersCompare

[ Source](https://github.com/lukaskorl/apigen)[ Packagist](https://packagist.org/packages/lukaskorl/apigen)[ RSS](/packages/lukaskorl-apigen/feed)WikiDiscussions develop Synced today

READMEChangelogDependencies (5)Versions (6)Used By (0)

API Generator for Laravel 4
===========================

[](#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
------------

[](#installation)

```
composer require lukaskorl/apigen
php artisan apigen:publish

```

### Recommended steps after installation

[](#recommended-steps-after-installation)

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
-----

[](#usage)

### Note on namespace

[](#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

[](#generating-a-resources)

When generating a resource *APIgen* will generate for you:

- Migration
- [Eloquent](http://laravel.com/docs/eloquent) Model
- [Repositoy](https://github.com/lukaskorl/repository)
- [RESTful](https://github.com/lukaskorl/restful) Controller leveraging repository
- Laravel route
- [Administration backend](https://github.com/lukaskorl/administrator)

To create a new resource simply run an [Artisan](http://laravel.com/docs/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

[](#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

[](#generating-a-model)

*APIgen* can generate will generate an Eloquent model for you.

### Setting up an administration backend

[](#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](https://github.com/lukaskorl/administrator).

Contributions
-------------

[](#contributions)

### Making changes to JavaScript &amp; CSS

[](#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 &amp; CSS

```
gulp build

```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

4412d ago

PHP version history (2 changes)v0.1PHP &gt;=5.3.0

v0.2PHP &gt;=5.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5153265?v=4)[lukaskorl](/maintainers/lukaskorl)[@lukaskorl](https://github.com/lukaskorl)

---

Top Contributors

[![lukaskorl](https://avatars.githubusercontent.com/u/5153265?v=4)](https://github.com/lukaskorl "lukaskorl (28 commits)")

### Embed Badge

![Health badge](/badges/lukaskorl-apigen/health.svg)

```
[![Health](https://phpackages.com/badges/lukaskorl-apigen/health.svg)](https://phpackages.com/packages/lukaskorl-apigen)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[rapidez/core

Rapidez Core

1823.5k72](/packages/rapidez-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
