PHPackages                             alibori/laravel-api-resource-generator - 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. alibori/laravel-api-resource-generator

ActiveLibrary[API Development](/categories/api)

alibori/laravel-api-resource-generator
======================================

Package to generate API resources from models.

v1.4.2(1y ago)222.6k1MITPHPPHP &gt;=8.2

Since Feb 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/alibori/laravel-api-resource-generator)[ Packagist](https://packagist.org/packages/alibori/laravel-api-resource-generator)[ RSS](/packages/alibori-laravel-api-resource-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (9)Versions (13)Used By (0)

Laravel API Resource Generator Package
======================================

[](#laravel-api-resource-generator-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/589d3f52a23809532aa620770191001af9465f010f1967e50c190346a271842d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c69626f72692f6c61726176656c2d6170692d7265736f757263652d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alibori/laravel-api-resource-generator)[![Tests Passed](https://github.com/alibori/laravel-api-resource-generator/actions/workflows/run-tests.yml/badge.svg?event=push)](https://github.com/alibori/laravel-api-resource-generator/actions/workflows/run-tests.yml/badge.svg?event=push)[![Total Downloads](https://camo.githubusercontent.com/b340636008abd3bb03526fa6b5d6ae22466452c32184485a907a8290643c0b73/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c69626f72692f6c61726176656c2d6170692d7265736f757263652d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alibori/laravel-api-resource-generator)

This package will help you to generate API resources for your Laravel project.

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

[](#installation)

You can install the package via composer:

```
composer require alibori/laravel-api-resource-generator --dev
```

Usage
-----

[](#usage)

All you need to do is run the following command:

```
php artisan api-resource:generate
```

If you want to generate multiple resources at once, you can pass multiple model names separated by a comma:

```
php artisan api-resource:generate ,,
```

This command will generate a new resource for the given model/s name/s with the properties defined in the model.

If you want to set the array keys of the resource as *camelCase*, you will be prompted to do it.

For example, for the model named `User` you will get the following resource:

```
