PHPackages                             ratiw/api - 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. ratiw/api

ActiveLibrary

ratiw/api
=========

A simple Laravel API package.

247PHP

Since Feb 13Pushed 11y ago1 watchersCompare

[ Source](https://github.com/ratiw/Api)[ Packagist](https://packagist.org/packages/ratiw/api)[ RSS](/packages/ratiw-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Api
===

[](#api)

A simple Laravel based API package using [Fractal](http://fractal.thephpleague.com/). At the moment, Laravel 5 is not yet officially released, so this package was based on Laravel 4.2.

This package simplify the API request building and transforming using The PHP Leagues's `Fractal` as the underlying engine.

To use it, you just need to follow these 3 steps

- Create API endpoint by extending the `Ratiw\Api\BaseApiController` class.
- Create Transformer by extending `Ratiw\Api\BaseTransformer` class.
- Create a route for it.

Installation
------------

[](#installation)

Installation can be done via `composer`

```
"require": {
    "ratiw/api": "dev-master"
}

```

This package requires `Laravel Framework` v4.2 and `Fractal` v0.9.\*, so it will be pull in automatically

Usage
-----

[](#usage)

\####Let's make the assumptions

- The API code will be in `Api` directory.
- The following PSR-4 namespaces were defined in `composer.json` like so

```
	...
	"autoload": {
		"psr-4": {
			"Api\\": "app/Api",
			"Entities\\": "app/Entities"
		}
	}
	...
```

- The API classes will be put in `Api\Controllers` directory.
- The Transformer classes will be put in `Api\Transformers` directory.
- A simple `Client` eloquent based class exists in the `Entities\\Clients' directory.

```
