Download the PHP package bkstar123/laravel-api-buddy without Composer

On this page you can find all versions of the php package bkstar123/laravel-api-buddy. 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?
bkstar123/laravel-api-buddy
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package laravel-api-buddy

laravel-api-buddy

This lightweight Laravel package provides a powerful and simple toolset for quickly building high-quality RESTful API web services for Eloquent model resources with several advanced features such as schema transformation as well as sorting, filtering, selecting and paginating. Using together with the Laravel Passport package, you can have a full-fledge API system ready to serve any clients in a matter of minutes.

Note:
– This is not a silver bullet to solve all API problems, for example: it does not support , queries. It does not “apifyies” your model resources out of the box, it is just your buddy to build a powerful API system as quickly as possible. There are many rooms for you to personalize your API design, laravel-api-buddy makes your journey easier, more comfortable and saves you from doing some boilerplate coding.

– Please visit https://github.com/bkstar123/api-demo for a detailed example about building API endpoints using bkstar123/laravel-api-buddy & Laravel Passport.

1 Requirements

It is recommended to install this package with PHP version 7.1.3+ and Laravel Framework version 5.6+

2 Installation

composer require bkstar123/laravel-api-buddy

It will also install ** as a dependency. You can visit https://github.com/barryvdh/laravel-cors for the detailed description of that package.

After installing, run:

It will copy all necessary configuration files to &

3 Configuration

is the config file of ** package, you should consult its documentation for the further details.

is the package's main config file, it contains the following options:

4 Usage

Supposing that we need to build some API endpoints for resource.

4.1 General information

The package provides ** as the base API controller that can be extended by other API controllers. This has been automatically injected with an instance.

You can quickly scalfold an API controller with command. For example:

All API controllers extending have access to the property $apiResponser which holds an instance. The instance exposes the following methods:

Where:

The following arguments are to be passed only in the case of using transformation:

4.2 Without transformation

4.3 With transformation

Set option to in

a) Create API resource

The API resource will be created in directory, it extends

You can add more metadata to API response by using hook which accepts the mapping returned by as the only argument, enrich & return it, for example:

b) Create transformer
Run:

This class defines the mapping between the model's original columns and their transformed versions (mainly for the purpose of client->server direction)

c)

For some requests that modify the state of resource such as POST (creating new instance), PUT & PATCH (updating an existing instance), you will need to use middleware which are automatically registered with the Laravel IoC container by the package. This middleware only requires an argument which is the fully qualified name of the transform class (in the above example, it should be ), and it converts user inputs to their corresponding original database table column names & vice versa in case of validation errors.

4.4 CORS enabling

To enable CORS for all API endpoints, just register the middleware in 's 's key as follows:

This middleware is automatically register with Laravel IoC container by the package.

4.5 Consuming API

You can use the following queries to customize the API response:

a) Sorting

Sort the response data by col1 in the ascending order & col2 in the descending order

b) Selecting

Includes only col1 & col2 in the response data

c) Filtering

Filter the response data where and

The accepted operators: (defaults to )

d) Paginating

Paginating the response data with the page size of 10 items and get the page 6


All versions of laravel-api-buddy with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3
barryvdh/laravel-cors Version ^0.11.3
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 bkstar123/laravel-api-buddy contains the following files

Loading the files please wait ....