Download the PHP package coreproc/api-builder without Composer

On this page you can find all versions of the php package coreproc/api-builder. 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 api-builder

API Builder for Laravel

Latest Version on Packagist Build Status Quality Score Total Downloads

API builder for Laravel aims to provide a quick and standard way of creating APIs. When you create an API for your resource using this package, you will get the standard CRUD endpoints and is flexible enough to adapt to the needs of your business logic.

Installation

You can install the package via composer:

Usage

To start using API builder, simply create a controller, have it extend the ApiBuilderController class, then define the necessary information regarding the resource. Here is what a basic controller should look like:

This controller assumes that you have a Post model and a PostTransformer transformer. If you don't know about transformers, you can find more information here.

Now, to make the above controller accessible, all we need to do is define the route in routes/api.php.

Once defined in your routes, you will now get the following endpoints:

Querying / Filtering

One of the main points of this package is to have a querying/filtering feature capable enough so that API consumers can have complete control over what they are looking for.

Inspired by GraphQL, the same way of adding operands to the parameters have been applied.

For example, if you want to query for all the Posts from a particular user ID, you would do this:

But if you wanted to query for all Posts where the user ID is greater than 5 (for example), you would do it like this:

The same would be applied for all the parameters defined in your $allowedParams variable of your controller. You are required to define which parameters are allowed to be passed through the query if you want to use this feature.

Here is another example. If you would like to get Posts where the title contains the word "test", here is how you would do it:

Here is the complete list of operands that you can use:

Now if you wanted to modify / apply a filter when indexing the resource by default, you can do so by overriding the indexQuery() method in your controller:

By doing the above, indexing the resource will only yeild results that have the user ID of the currently logged in user. You can do additional logic here as well.

Dates

Querying / Filtering of dates are also allowed and operands can be used as well. However, you will have to define the fields which are dates:

Once that is defined, you can pass any value that Carbon::parse() can parse. For example:

Sorting

Sorting is also possible when going through the index of your resource. Here is an example:

This will sort all Posts by their published date in ascending order. To change the direction of the order, pass the desc value along like so:

Please note that this package will be reserving the sort keyword for its sorting feature. (Roadmap: make this configurable)

Null values

To pass null values, this package reserves the null value to the query values. Everything that is passed with the null string will be converted into a NULL value in the backend. Here is an example on how to use it:

Limiting results

You can also limit your results by passing the limit parameter:

Pagination

By default the index of the resource returns a paginated result. The default number of results per page is 15. (Roadmap: make this configurable)

To increase the number of results per page, you can pass the per_page parameter:

Pages can be navigated by defining the page number:

Creating a resource

// TODO

Creation Rules

// TODO

Viewing a resource

// TODO

Updating a resource

// TODO

Update rules

// TODO

Deleting a resource

// TODO

Authorization

// TODO

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

About CoreProc

CoreProc is a software development company that provides software development services to startups, digital/ad agencies, and enterprises.

Learn more about us on our website.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of api-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
ellipsesynergie/api-response Version ^0.15.0
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 coreproc/api-builder contains the following files

Loading the files please wait ....