PHPackages                             fadugyamfi/laravel-api-base - 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. fadugyamfi/laravel-api-base

ActiveLibrary[API Development](/categories/api)

fadugyamfi/laravel-api-base
===========================

Laravel Package for easy RESTful API development

v1.0.0(1y ago)3711.2k7MITPHP

Since Nov 8Pushed 12mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (21)Used By (0)

laravel-api-base
================

[](#laravel-api-base)

Laravel Package For Easy RESTful API Development

About
-----

[](#about)

This library enables you to significantly speed up the development of your RESTful API with Laravel by providing you the base Controller, Request, Resource and Model with all the CRUD functionality you will need as well as data search and count endpoints.

Installation
============

[](#installation)

The preferred method of installation is via \[Packagist\]\[\] and \[Composer\]\[\]. Run the following command to install the package and add it as a requirement to your project's `composer.json`:

```
composer require fadugyamfi/laravel-api-base
```

Latest Laravel versions have auto dicovery and automatically add service providers, however if you're using Laravel 5.4.x and below, remember to add it to `providers` array at `/app/config/app.php`:

```
// ...
LaravelApiBase\Providers\LaravelApiBaseProvider::class,
```

Routing Configuration
---------------------

[](#routing-configuration)

### Laravel 10 and below

[](#laravel-10-and-below)

Lastly, and most importantly, this package provides an updated `Router`, i.e. `LaravelApiBase\Services\ApiRouter` that you must configure in your `app/bootstrap/app.php` file to get the full benefits of the api. You need to add the following code in the file.

```
/**
 * Laravel 10 and below
 *
 * Important change to ensure the right router version is used with the Laravel API Base package
 */
$app->singleton('router', LaravelApiBase\Services\ApiRouter::class);
```

### Laravel 11 and above

[](#laravel-11-and-above)

In Laravel 11, instead of a completely separate "custom router," you primarily rely on the standard Laravel routing system with enhanced capabilities. In Laravel 11, replacing the router by binding a singleton to the container `(e.g., app()->singleton('router', ...))` is not recommended and not officially supported. Laravel’s routing system has become more tightly integrated and relies on internal contracts and bootstrapping that can break if you override the router in this way.

**Best Practice** in Laravel 11 is to use route macros to extend routing functionality to add support for the `search` and `count` endpoints.

```
