Download the PHP package flipboxstudio/api-fracture without Composer

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

Fracture

Fracture is a library to make your Laravel-based API response more consistent.

Installation

Configuration

Add this line to your service provider list:

After that, run:

This command will copy an empty fracture.php configuration into your config directory. You may need to read this file for more custom configuration.

Optional

Add this line to your facade list:

Usage

Fracture will override Laravel Controller invoke style. So, to make this feature works on your project, you need to change your base controller. Locate this file at:

Change this file into:

And you ready to rock! Below is example using fracture.

Fracture has it's own default transformer which you can configure it on fracture.php config file. From above controller (with fracture default transformer), here's your response transformed into:

To configure your transformer, Fracture will determine the object returned from controller. So, to transform your App\User object, you need to configure the transformer in fracture.php, file inside transformers, add app_user information there:

Fracture will automatically camel_case your current transformer to determine which config should it use. So for App\User resource type, it will parsed to app_user. Inside that key, give it an array key-value based with class value as it's transformer. Here's a basic transformer:

From the above transformer, the response will be transformed into:

Set Transformer on The Fly

You can set the transformer just before the response being sent to client. To do so, before return any response in controller method, you may call Fracture::setTransformer method:

Route Transformer

You also can tell Fracture to use certain transformer via route actions:

Custom HTTP Status Code

Generating Error Response

Here's a snippet to generate error response:

From that code, the response is:

In debug mode:

ToDo


All versions of api-fracture with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
league/fractal Version ^0.13.0
laravel/framework Version 5.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 flipboxstudio/api-fracture contains the following files

Loading the files please wait ....