Download the PHP package fadugyamfi/laravel-api-base without Composer

On this page you can find all versions of the php package fadugyamfi/laravel-api-base. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-api-base

laravel-api-base

Laravel Package For Easy RESTful API Development

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

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:

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:

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.

Using the Library

These examples assume you already have your database setup and just need to wire up your Models, Controllers and Routes.

Making Requests to the API

Once your API endpoints are configured you can make the following requests easily

Standard RESTful API Requests

Querying and Paginating Results

This is where the package shines and enables you to flexible work with your API Endpoints

Searching/Filtering Data

You can search and filter data using any field that is included in the model $fillables and apply operators to them to enhance the queries

Available Search Operators

Working With Associated Models

You can return any kind of model association that the with() operation supports in Laravel Eloquent Models

Sorting Results

You can also sort results by any field when querying

Configuring Your Application

Now you know what is possible, let's show you how to set everything up so you can try this out. This section assumes you have a database table called todos. We'll set up the Model, Controller, FormRequest and JSONResource for that specific endpoint

Setting up your Model

To access the data you will need a model.

You can also implement the ApiModelInterface and use the ApiModelBehavior Trait and for existing Models that cannot extend the the ApiModel class directly for other reasons, e.g. the default User model

Observables Are Encouraged

When working with your API Models, we encourage you to use Observers to listen and react to events in your model for the cleanest code possible. Example:

Then in your app\Providers\EventServiceProvider.php file, you can connect your Observer to your Model

Setting up Requests for Input Validations

When creating or updating a record, we often need to validate the inputs. Creating a Request object will enable this to happen behind the scenes.

Setting up a JSONResource to format your responses

You can customize the response that comes back to your users by creating a subclass of LaravelApiBase\Http\Resources\APIResource

Setting up your Controller

By simply specifying the model to use, the controller will infer any resources or request objects needed and use them for all your restful endpoints

If your Request and Resource classes do not live in the default directories, i.e. App\Http\Requests and App\Http\Resources, you can override the automatic path resolution by in your Controller __construct() function

Configuring the Routes for your Todo endpoint

Once you have everything setup, you can now add a route that will make your resource available. You should potentially add these to the routes/api.php file.

Generating API Documentation

This library is designed to work with the Scribe Documentation Generator. Install the library and run the following command to generate your documentation.

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub

Author

Francis Adu-Gyamfi - https://www.linkedin.com/in/francis-adu-gyamfi-3b782716/
See also the list of contributors which participated in this project.

License

Laravel API Base is licensed under the MIT License - see the LICENSE file for details

Acknowledgements

This library was possible due to the team of developers at Matrix Designs who inspired its creation.


All versions of laravel-api-base with dependencies

PHP Build Version
Package Version
Requires illuminate/http Version ^5.2|^6|^7|^8|^9|^10|^11
illuminate/support Version ^5.2|^6|^7|^8|^9|^10|^11
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fadugyamfi/laravel-api-base contains the following files

Loading the files please wait ....