PHPackages                             w2w/laravel-apie - 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. w2w/laravel-apie

AbandonedLibrary[API Development](/categories/api)

w2w/laravel-apie
================

Laravel wrapper for w2w/apie

3.3.0(5y ago)14.2kGPL-3.0-or-laterPHPPHP ^7.2

Since Oct 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/pjordaan/laravel-apie)[ Packagist](https://packagist.org/packages/w2w/laravel-apie)[ RSS](/packages/w2w-laravel-apie/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (16)Versions (46)Used By (0)

laravel-apie
============

[](#laravel-apie)

Laravel wrapper for the apie library [![CircleCI](https://camo.githubusercontent.com/793620242a93a67361905412f82d7858facaaf1c9fd967df8390f32f05574dd0/68747470733a2f2f636972636c6563692e636f6d2f67682f706a6f726461616e2f6c61726176656c2d617069652e7376673f7374796c653d737667)](https://circleci.com/gh/pjordaan/laravel-apie)[![codecov](https://camo.githubusercontent.com/b1d2d99d0eab958f3ed3cfc7966686bb95417aad1cc1b4e0d2eb5e5c7db4da69/68747470733a2f2f636f6465636f762e696f2f67682f706a6f726461616e2f6c61726176656c2d617069652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/pjordaan/laravel-apie/)[![Travis](https://camo.githubusercontent.com/e84942549effd0ab1a675b74de13f9fa583a5196eb31447488ff21cb0384961a/68747470733a2f2f6170692e7472617669732d63692e6f72672f706a6f726461616e2f6c61726176656c2d617069652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pjordaan/laravel-apie)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/932889fd9fe76078ce829beb6dcf81804e5cef4731ccfe545d421d333b95879f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706a6f726461616e2f6c61726176656c2d617069652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pjordaan/laravel-apie/?branch=master)

What does it do
---------------

[](#what-does-it-do)

This is a small wrapper around the library [w2w/apie](https://github.com/pjordaan/apie) for Laravel. This library maps simple POPO's (Plain Old PHP Objects) to REST api calls. It is very similar to the excellent api platform library, but then for Laravel.

It also adds a class EloquentModelDataLayer to persist and retrieve api resources as Eloquent models and adds a status check to see if it can connect with the database. See the documentation of apie at

Forwards compatiblity Apie version 4
------------------------------------

[](#forwards-compatiblity-apie-version-4)

By default laravel-apie will still use the old 3.\* serialization. In Apie version 4 this will change drastically, so a config option is added to enable the forwards compatible 4.\* release.

Contents
--------

[](#contents)

1. [Installation](#Installation)
2. [Lumen integration](docs/02-lumen-integration.md)
3. [Adding a a new api resource](#adding-a-new-api-resource)
4. [Automate registering classes](#automate-registering-api-resources)
5. [Hooking in the laravel/lumen error handler](docs/05-error-handler.md)
6. [Optimizations for production](docs/06-optimizations.md)
7. [Versioning](docs/07-versioning.md)
8. [Integrate Eloquent with Apie](docs/08-eloquent-data-layer.md)
9. [Custom normalizers/value objects](docs/09-custom-normalizers.md)
10. [Modifying OpenAPI spec](docs/10-modifying-openapi-spec.md)
11. [Use your own controllers](docs/11-own-controllers.md)
12. [Resource sub actions](docs/12-sub-actions.md)
13. [Laravel components integration](docs/13-laravel-component-integrations.md)
14. [PSR6 Cache integration](docs/14-cache-integration.md)
15. [L5-swagger integration](docs/15-l5swagger-integration.md)
16. [Localization aware API](docs/16-localization.md)

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

[](#installation)

In your Laravel package you should do the usual steps to install a Laravel package.

```
composer require w2w/laravel-apie
```

In case you have no autodiscovery on to add W2w\\Laravel\\Apie\\Providers\\ApiResourceServiceProvider::class to your list of service providers manually.

Afterwards run the commands to publish the config to apie.php and run the migrations for the status checks.

```
artisan vendor:publish --provider="W2w\Laravel\Apie\Providers\ApiResourceServiceProvider"
artisan migrate
```

Now visit /swagger-ui to see the generated OpenApi spec. It will only contain specs for the default installed api resources, which is a check to identify your REST API and a health check resource. It will check if it can connect to the database.

Adding a new api resource
-------------------------

[](#adding-a-new-api-resource)

create this class in your app/ApiResources:

```
