Download the PHP package saad/fractal without Composer

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

An easy to use Fractal wrapper built for Laravel applications upon Spatie/Fractal Package

Spatie/Fractal

Install

You can pull in the package via composer:

The package will automatically register itself.

Laravel Version

this package is compatible with laravel versions >= 5.5

Changelog

V 1.2.0

  1. Add Strict Mode, so for null resources instead of returning empty array it will return null, By Default strict mode is Enabled

use

Exactly as spatie except that this package is automatically parse includes or excludes from parameters first if defined, otherwise it will look for query string includes and excludes

Default serializer is ArraySerializer

Console Generator

you can generate a new transformer class using the following command

the following command will create "App\Transformers\UserTransformer.php"

to create in nested folders "App\Transformers\Sub1\Sub2\UserTransformer.php"

Request Includes

will include defined includes from availableIncludes array

Force Includes

we could also pass includes to create method as the 4th argument which will have the heighest periority than request include will include defined includes from availableIncludes array

Request Excludes

will exclude defined includes from defaultIncludes array

Force Excludes

we could also pass excludes to create method as the 5th argument which will have the heighest periority than request include will include defined includes from defaultIncludes array

Transformer Abstract Class

this package has a base abstract Transformer Class Saad\Fractal\Transformers\TransformerAbstract you could use as the base class of your transformers, this class is based on extends League\Fractal\TransformerAbstract and adds the following features:

TransformerAbstract::strictMode(bool)

This mode added since V 1.2.0

null resources is returning empty array, when enable strict mode it will return NULL instead. By default strict mode is enabled

To control strict mode you could call one of these methods in one of the service providers boot method:

Enable Strict Mode (Enabled By Default):
TransformerAbstract::strictMode(true)
TransformerAbstract::enableStrictMode()

Disable Strict Mode:
TransformerAbstract::strictMode(false)
TransformerAbstract::disableStrictMode()

transform() replaced by transforWithDefault()

you should use transforWithDefault() methodcinstead of transform() method this is because the new addEexternal feature

addExternal($key, $value)

you can add external value to output

addDefaultInclude(string|array $defaults_to_add)

will add provided keys to defaultIncludes array

Fractal Request Parser Singletone

this package also contains a singletone Saad\Fractal\FractalRequestParser which is a helper class that provides usefull methods about Request includes and excludes with the following methods :

__Saad\Fractal\FractalRequestParser::includesHas($key_path)__

__Saad\Fractal\FractalRequestParser::excludesHas($key_path)__

assume we have the following request URI ?include=name,sub.name:lang(ar),sub.country

the same for excludesHas()


All versions of fractal with dependencies

PHP Build Version
Package Version
Requires spatie/laravel-fractal Version ^5.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 saad/fractal contains the following files

Loading the files please wait ....