Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Fractal Laravel Package

league/fractal

League Fractal is a transformation/presentation layer for API output (JSON/YAML). Define consistent serializers and transformers, type-cast fields, include related resources, and handle pagination—keeping response schemas stable as your data changes.

View on GitHub
Deep Wiki
Context7
0.21

What's Changed

Backwards incompatible changes

  • Current scope now gets cleared after transformation completes. If you're rely on ->getCurrentScope() after transformation completes, you'll need to update your transformer to capture the value during transformation. See #582

New Contributors

Full Changelog: https://github.com/thephpleague/fractal/compare/0.20.2...0.21

0.20.1

What's Changed

New Contributors

Full Changelog: https://github.com/thephpleague/fractal/compare/0.20...0.20.1

0.20

This release moves Fractal up to modern PHP.

We have dropped support for 5.x with this release. Fractal now supports PHP 7.4 as the lowest PHP version. Should you need to keep using Fractal with PHP 5.x, please use 0.19.2 or lower. We will continue to patch security fixes for 0.19 but all new features and changes will be in the 0.20 release and more going forward. We will aim for a 1.0 release this summer targeting 8.x

What's Changed

New Contributors

Full Changelog: https://github.com/thephpleague/fractal/compare/0.19.2...0.20

0.19.2
0.19.1
  • Allow sub relations with modifier #490 - thanks @onursimsek - docs
  • Update TravisCI to allow failures on PHP 5.4 and 5.5 - thanks @matthewtrask
0.19
  • Allow sub relations with modifier #490 - thanks @onursimsek - docs
  • Update TravisCI to allow failures on PHP 5.4 and 5.5 - thanks @matthewtrask
0.18.0

Enhancements

  • Allow PHPUnit 7+ where available - Thanks @ramsey
  • Changed the paginator to not call $paginator->getPaginate() in PhalconFrameworkPaginatorAdapter constructor - Thanks @niden
  • Output an object for attributes when none are provided instead of an array in JsonApiSerializer - Thanks @BastianHofmann
  • Include meta key for relationships in JsonApiSerializer - Thanks @rawaludin
  • Allow self link to override defaults in JsonApiSerializer - Thanks @biggator
  • Preserve numeric keys when converting Scopes to arrays by using array union instead of array_merge - Thanks @andrewtweber
  • Output an object for links when none are provided instead of an array in ArraySerializer pagination - Thanks @basavind
  • Allow arrays for field lists in $fractal->parseFieldsets() - Thanks @flugger
  • Add links for all available includes to JsonApiSerializer - Thanks @matt-allan
0.17.0
  • Add ScopeFactoryInterface and ScopeFactory
  • Add $options parameter to toJson
  • Added Serializer interface to SerializerAbstract
  • Add Primitive resource type, allows to use primitives
  • optimized primitive transformation when transformer is not given
0.16.0

Enhancements:

  • #358 Allow the ability to define meta on each object in collection
  • #362 Add DoctrinePaginatorAdapter to interface with Doctrine pagination
  • Implement sparse fieldset
0.15.0
  • Custom links in serializer
  • PhalconPHP Paginator
  • tested on 7.1
0.14.0

Added

  • null() method for serializing null resource.
  • Adds pagination to JsonApiSerializer
  • Added JSON-API serializer collection links

Enhancements

  • Fix issue including relationships on collections
  • TransformerAbstract now returns a ResourceInterface
  • getIncludeParams now always return ParamBag
  • cody styling, method naming and docs
0.13.0

Added

  • ->setData(...) and ->setTransformer(...) methods to resources
  • able to set url include parameters with no set variables, ie. include=comments:limit(5|1):new

Changed

  • Finally, much improved JSON-API support thanks to @felixkiss

Enhancements

  • Short array syntax throughout
  • Test improvements
0.12.0

Added

  • Added PHP 7.0-dev support.
  • Add the support for Laravel 5 paginator. Issue #153

Changed

  • Now accessing the default and available includes in Transformers via getters Issue #158

Removed

  • Dropped PHP 5.3 support. Use v0.11 if you're still stuck on PHP 5.3.
  • Removed getData() and getTransformer() from League\Fractal\Resource\Collection as they were already defined in ResourceAbstract.
0.11.0

Added

  • Added League\Fractal\Pagination\PagerfantaPaginatorAdapter to support Pagerfanta
  • Added League\Fractal\Pagination\ZendFrameworkPaginatorAdapter to support Zend Framework Paginator

Fixed

  • Now JSON-API linked items will be unique based on their ID Issue #126
0.10.0

Features:

  • Added ParamBag to replace the array passed to includes. It implements array access so keep using it as you were, or play with the new methods.

Bugs:

  • Removed PaginatorInterface::getPaginator() as it was used anymore. Issue #101
  • Manager::createData() argument 1 now hints against ResourceInterface not ResourceAbstract.
0.9.0

Only one change this time around: Splitting Serializer methods for item and collection to be their own thing.

This was done to fix #71 as well as make life easier for people who want to make items and collections use some different logic. For example, JsonApiSerializer wants even a single item to appear inside an array, meaning we can wrap the data in the item() serializer method to do that, but keep it as an item in case anyone wants to switch to a different serializer.

See Serializers documentation for more information.

0.8.3

Features:

  • Default Includes no longer need to be in Available Includes. Issue #58
0.8.2
  • Fixed Invalid argument supplied for foreach()
0.8.1

Features:

  • Make ResourceAbstract implement ResourceInterface

Bug:

  • Fixed tests for Laravel 4.2 usage
0.8.0

Features

  • Added Serializers with ArraySerializer, DataArraySerializer (default) and a provisional JsonApiSerializer. (#47).
  • Added ResourceAbstract::setMeta('foo', mixed) to allow custom meta data
  • Replaced Manager::setRequestedScopes() with Manager::parseIncludes('foo,bar') which can be an array or CSV string. It can also take "Smart Syntax" such as Manager::parseIncludes('bars:limit(5|1):order(-something)'), which can come from a URL query param: /foo?include=bars:limit(5|1):order(-something).
  • Made all pagination (paginators and cursors) use meta output logic, so it sits with your custom meta data
  • Moved League\Fractal\Cursor\Cursor and League\Fractal\Cursor\CursorInterface into League\Fractal\Pagination.
0.6.1
  • Added Cursor support, for large data sets.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport