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

Laravel Apiable Laravel Package

open-southeners/laravel-apiable

View on GitHub
Deep Wiki
Context7
4.3.0

Added

  • AssertableJsonApi::data(Closure) — scope into the data member using the full AssertableJson fluent API (where, has, missing, count, etc, dd, dump, when, tap, …)
  • AssertableJsonApi::meta(Closure) — scope into meta
  • AssertableJsonApi::links(Closure) — scope into links
  • AssertableJsonApi::errors(Closure) — scope into errors
  • AssertableJsonApi::included(Closure) — scope into included
  • AssertableJsonApi::relationship(string $name, Closure) — scope into relationships.{name}.data of the current resource
  • AssertableJsonApi::at(int $position, Closure $callback) — optional closure variant; when a callback is supplied the method runs assertions inside that scope and returns $this (the collection) for further chaining
  • AssertableJsonApi::atRelation(Model $model, Closure $callback) — optional closure variant on atRelation
  • AssertableJsonApi::assertIsJsonApiDocument() — validates the top-level JSON:API document structure (requires at least one of data/errors/meta; data and errors must not coexist; included requires data)
  • Error documents (errors, no data) are now accepted by fromTestResponse and can be asserted via errors()

Changed

  • AssertableJsonApi constructor is now aligned with the parent AssertableJson(array $props, ?string $path = null). All JSON:API state (id, type, attributes, relationships, included) is now derived from props via accessors instead of stored as separate fields. As a result, parent methods scope(), first(), each(), where(), has(), missing(), count(), etc(), dd(), dump(), when(), tap() are now fully functional on AssertableJsonApi instances.
  • fromTestResponse no longer silently collapses a collection response to the first item. Calling hasAttribute(), hasId(), hasType(), or relationship methods directly on a collection root now operates on the root document, not the first item. Use ->at(0) to scope into a specific collection item before running those assertions.
  • hasAttribute($name, $value) value comparison tightened. The old implementation used assertContains($value, $attributes) which matched the value against any attribute — regardless of key. The new implementation uses assertSame($value, $attributes[$name]) which correctly checks the exact key/value pair. Action required: any test that relied on the old loose matching (e.g. hasAttribute('subtitle', 'Hello') passing because a different key happened to hold 'Hello') needs to be corrected.
  • hasAttribute($name, $value) skipping falsy values fixed. The old guard was if ($value), which skipped the value check when $value was 0, false, or ''. The guard is now if ($value !== null), so values of 0 and false are correctly asserted.
  • toArray() now returns the full document props (delegating to AssertableJson::toArray()) instead of only the attributes of the current resource. Code that called ->toArray() to obtain attributes should use ->toArray()['data']['attributes'] or ->prop('data.attributes').
  • hasNotAttribute($name, $value) semantics clarified. Without $value, asserts the attribute key is absent. With $value, asserts that either the key is absent or the key's value differs from $value. Previously the method always failed if the key existed, even when only checking that a specific value was not present.
  • hasAttributes() now accepts both list form (['title', 'abstract'] — key existence only) and map form (['title' => 'Hello'] — key + exact value).

Fixed

  • scope(), first(), each() from the parent now work correctly because the constructor matches the parent signature
  • AssertableJsonApi::rootProps is threaded into child scopes so included, meta, and links are reachable from any scope depth
4.2.0

Added

  • Apiable::modelResourceMap() to register custom JsonApiResource classes per model globally
  • Apiable::jsonApiResourceFor() to resolve the registered resource class for a given model instance
  • JsonApiResponse::usingResource() to override the resource class used for serialization per-response
  • JsonApiResource::toApplicationJsonArray() for plain JSON serialization merging model attributes with computed ones

Fixed

  • Related models in included relationships now resolve through the resource registry instead of always using the base JsonApiResource class
  • Pivot relationship meta keys were not being prefixed correctly (array_walk callback was not returning the modified array); replaced with an explicit loop
4.1.0

Added

  • Multiple scoped filters parameters values (e.g. /?filter[withStatuses]=Active&filter[withStatuses]=Archived) (#15)

Fixed

  • Issue when included repeated relationships replaced others (#11)
4.0.0

Added

  • apiable:docs command to generate API documentation from PHP attributes in Postman v2.1, Markdown/MDX, and OpenAPI 3.1 formats
  • $description property to all *QueryParam attributes for documentation generation
  • #[DocumentedResource], #[DocumentedEndpointSection], and #[EndpointResource] PHP attributes for annotating controllers
  • OpenSoutheners\LaravelApiable\Documentation\Generator class for building resource documentation trees from registered routes
  • OpenSoutheners\LaravelApiable\Http\JsonApiPaginator class exposing pagination logic as a typed static method
  • Laravel 13 support

Fixed

  • Handler::includesTrace() was calling env('APP_DEBUG') outside of the config directory, which returns null in production; now uses config('app.debug')
  • IteratesResultsAfterQuery had leaked application-specific imports (App\Domain\Process\Models\Box\Box, App\Models\ModelForm) left over from a real project
  • addAppendsToResult() instanceof JsonApiCollection check was unreachable because it was nested inside an instanceof JsonApiResource branch (since JsonApiCollection extends JsonApiResource); logic restructured to check the most-specific subtype first
  • addAppendsToResult() instanceof Paginator branch was using the Paginator contract which does not declare through(); changed to AbstractPaginator
  • CollectsResources::collects() was missing a return null fallback, causing PHPStan to report a missing return statement
  • isScope() in ApplyFiltersToQuery was using get_parent_class() to exclude base builder methods, which could return false for unknown types; now diffs against Illuminate\Database\Eloquent\Builder::class directly, which is also more accurate
  • Various PHPDoc type corrections in documentation exporters and Generator (malformed class name OpenSouthenersLaravelApiableDocumentationResource\OpenSoutheners\LaravelApiable\Documentation\Resource)

Removed

  • Laravel 11 support
3.17.1

Fixed

  • Exceptions handler at issue #20
3.17.0

Added

  • Appends to raw JSON responses
3.16.4

Fixed

  • URL params getting double encoded
3.16.3

Fixed

  • Laravel param inconsistency with paginator page number also applies to FastPaginate
3.16.2

Fixed

  • Pagination returns wrong page name query parameter (Laravel framework is inconsistent around this)
3.16.1

Fixed

  • Apiable::toJsonApi() given collection as input returns empty response
3.16.0

Fixed

  • jsonApiPaginate() method typos
3.15.1

Fixed

  • Page number resolver not properly retrieved for jsonApiPaginate() method
  • Fast paginate package with new name and namespace check
3.15.0

Added

  • Laravel 12 support

Removed

  • Laravel 9 and 10 support
  • PHP 8.0 and 8.1 support
3.14.2

Changed

  • Replaced package open-southeners/laravel-helpers with open-southeners/extended-php
3.14.1

Fixed

  • Performance degradation issue on serialisation (infinite loop on nested includeds)
3.14.0

Added

  • Laravel 11 support
3.13.3

Fixed

  • Raw response without pagination returning query builder
3.13.2

Added

  • Raw response formatting to JsonApiResponse
3.13.1

Added

  • Type generics into:
    • OpenSoutheners\LaravelApiable\Http\JsonApiResponse
    • OpenSoutheners\LaravelApiable\Http\RequestQueryObject
    • OpenSoutheners\LaravelApiable\Http\Resources\JsonApiResource
    • OpenSoutheners\LaravelApiable\Http\Resources\JsonApiCollection
    • OpenSoutheners\LaravelApiable\Contracts\ViewQueryable
    • OpenSoutheners\LaravelApiable\Contracts\ViewableBuilder
3.13.0

Added

  • Handler::withHeader (used as apiable()->jsonApiRenderable()->withHeader) to add headers to JSON errors
3.12.0

Added

  • Includes relationships counts with tags_count (needs to end with _count). E.g:
JsonApiResponse::using(Post::class)->allowInclude(['tags_count']);

// Then request this with ?include=tags_count

Fixed

  • Some IDEs getting confused with returning self types in traits (replaced to static)
3.11.5

Changed

  • Fix open-southeners/laravel-helpers utilities package version constrain so other packages can use similar versions under the same major release
3.11.4

Fixed

  • Query withCount method usage with apiable is replacing the underlying added selects for these counts
3.11.3

Fixed

  • Force formatting always coming through even thought is not forced by config
3.11.2

Changed

  • Config file now with response.formatting with type and force sub-items as options

Fixed

  • Force formatting for Inertia based apps (now can use Apiable::forceResponseFormatting())
3.11.1

Fixed

  • Non existing class ForceAppendAttribute when reading controller attributes
3.11.0

Added

  • Default sorts using JsonApiResponse::applyDefaultSort method or OpenSoutheners\LaravelApiable\Attributes\ApplyDefaultSort attribute
  • Default filters using JsonApiResponse::applyDefaultFilter method or OpenSoutheners\LaravelApiable\Attributes\ApplyDefaultFilter attribute
  • Default formatting bypass using JsonApiResponse::forceFormatting method

Changed

  • Request::wantsJsonApi() only looks at Accept header, not looking for Content-Type one anymore
  • Now all requests can send a different Accept header if they want a diffent response formatting. For e.g. sending Accept: application/json will get raw JSON response. Default being configured in the config/apiable.php make sure to publish or update it
3.10.0

Added

  • Sorts now accepts relationships (for e.g. /posts?sort=tags.created_at)
3.9.2

Fixed

  • PHP deprecation warning on string vars interpolation
3.9.1

Fixed

  • JsonApiResponse using viewable builder (query scopes to filter by view permission) didn't send any user as first parameter
3.9.0

Added

  • JsonApiResponse::paginateUsing(fn ($query) => $query->simplePaginate()) method to customise pagination used in JSON API responses.
3.8.0

Changed

3.7.1

Fixed

  • Missing import to make work pivot attributes functionality
3.7.0

Added

3.6.1

Fixed

  • Added status code (401) to unauthorised responses
3.6.0

Fixed

  • Inconsistent behaviour with Apiable::toJsonApi() returning false sometimes, now returns an API resource/collection all the time (might be a breakchange therefore this was minor release)
3.5.2

Fixed

  • JsonApiResponse::conditionallyLoadResults() method doesn't work as expected
3.5.1

Fixed

  • Exceptions handler using apiable()->jsonApiRenderable() now returns thrown exception headers
3.5.0

Added

  • Backend now returns properly the Content-Type=application/vnd.api+json response header
3.4.2

Fixed

  • Filters with negative values like filter[attr]=0 won't be filtered out
3.4.1

Fixed

  • Apiable::jsonApiRenderable method, Handler missing import of Symfony's HttpException
3.4.0

Changed

  • Apiable::jsonApiRenderable now accepts 2 arguments: Throwable exception & second a bool nullable withTrace, error handling redesign to properly match JSON:API & Laravel.
3.3.1

Added

  • JsonApiResponse::conditionallyLoadResults to manage adding viewable query or not to the response
3.3.0

Added

  • Laravel 10 support
  • PHP native types

Removed

  • QueryParametersValidator constants ENFORCE_VALIDATION_STRATEGY & FILTER_VALIDS_ONLY_STRATEGY, now strategy parameter is changed to a boolean instead

Fixed

  • Types with static analysis
3.2.8

Fixed

  • Error when wrong typed parameter sent to IteratesResultsAfterQuery::appendToApiResource
3.2.7

Fixed

  • Filtering when wrong operator is present was returning exception, now ignores the operator (e.g. filter[attribute][0]=1&filter[attribute][1]=2)
3.2.6

Fixed

  • Deprecation notice on explode second argument
3.2.5

Added

  • forceAppendWhen method to JsonApiResponse
3.2.4

Fixed

  • Fix PHP 8 deprecation with string variable interpolation
3.2.3

Fixed

  • Fix issue reporting wrong status code when setup handler renderable receives a query exception: apiable()->jsonApiRenderable()
2.3.4

Fixed

  • Fix issue reporting wrong status code when setup handler renderable receives a query exception: apiable()->jsonApiRenderable()
3.2.2

Fixed

  • Filters values like: filter[attribute]=0 now doesn't get removed
3.2.1

Fixed

  • PHP 8.2 deprecation warnings
3.2.0

Added

  • PHP 8.2 support
3.1.3

Fixed

  • Fixed OR filters with rest of filtering or SQL query affecting negatively the results
3.1.2

Fixed

  • Fixed page[size] in request doesn't get the number of results when lower than model's $perPage (only on higher)
3.1.1

Fixed

  • Filtering scopes were not being applied
3.1.0

Added

  • Search (Laravel Scout) filters with allowed attributes and/or value(s): ?q=hello&q[filter][attribute]=foo or ?search=hello&search[filter][attribute]=foo
3.0.1

Fixed

  • Empty filter without attribute: ?filter=test was throwing an error
3.0.0

Fixed

  • Remove page parameter from pagination links when using withQuery

Changed

  • Filter relationship without any value applies relationship existence filtering, now doesn't
  • Filtering now handles AND/OR conditions properly
  • Filtering using OR condition (filter[status]=Active,Inactive) will be fully invalidated if one member doesn't pass the validation
  • RequestQueryObject::filters method now implements own logic instead of reusing Symfony's request one to be able to get AND filters with same keys (attributes) on a different array item

Removed

  • withWhereHas under filtering, now all related data is loaded (until reimplemented with AND/OR conditionals...)
2.3.3

Fixed

  • Add request query parameters to pagination links on JsonApiResponse resource collections
2.3.2

Fixed

  • Ambiguous columns when filtering on relationships attributes (redoing it right without any regression)
2.3.1

Fixed

  • Ambiguous columns when filtering on relationships attributes
2.3.0

Added

  • Conditionally filter out attributes that ends with "_id" (adding config option responses.include_ids_on_attributes)
  • JsonApiResponse::includingIdAttributes() method for setting responses.include_ids_on_attributes option value within an individual response
2.2.3

Fixed

  • Fix resolveFromRoute when using invokable controller JsonApiResponse
2.2.2

Fixed

  • JsonApiResponse::toArray returning wrong formatted JSON:API array
2.2.1

Fixed

  • JsonApiResponse::forceAppend method fails getting model class when from query builder
2.2.0

Added

  • requests.validate_params config option to apiable.php for enforcing validation. Requires to publish or manually copy [#7]
  • Additional filter operators like gte (greater or equal than), gt (greater than), lte (lower or equal than), lt (lower than) [#5]

Changed

  • Get allowed fields methods from apply query params pipeline classes moved to OpenSoutheners\LaravelApiable\Http\QueryParamsValidator
  • Operators from allowed_filters included to meta data are now URL-safe
  • allowed_sorts structure is now based on ['attribute' => 'allowed_direction']
  • Allow filters methods/attribute now accepts array with multiple operators
2.1.1

Added

  • Illuminate\Contracts\Support\Arrayable interface to JsonApiResponse so it can be used in Inertia responses (as an example)
2.1.0

Added

  • OpenSoutheners\LaravelApiable\Contracts\ViewQueryable and OpenSoutheners\LaravelApiable\Contracts\ViewableBuilder classes for models & custom query builders now functional with JsonApiResponse (can be disabled by config see config/apiable.php)
2.0.1

⚠️ Please make sure to run php artisan vendor:publish --force --provider="OpenSoutheners\LaravelApiable\ServiceProvider" ⚠️

Fixed

  • Getting wrong config keys
2.0.0

⚠️ Please make sure to run php artisan vendor:publish --force --provider="OpenSoutheners\LaravelApiable\ServiceProvider" ⚠️

Removed

  • JsonApiResponse::list and JsonApiResponse::getOne methods as isn't the responsibility of this package to act as query repository so it makes easier to encapsulate it into repository or whatever design pattern you're using. Use JsonApiResponse::using instead sending the query as its parameter.

Added

  • PHP 8 attributes for QueryParams:
    • OpenSoutheners\LaravelApiable\Attributes\FilterQueryParam
    • OpenSoutheners\LaravelApiable\Attributes\IncludeQueryParam
    • OpenSoutheners\LaravelApiable\Attributes\AppendsQueryParam
    • OpenSoutheners\LaravelApiable\Attributes\FieldsQueryParam
    • OpenSoutheners\LaravelApiable\Attributes\SortQueryParam
    • OpenSoutheners\LaravelApiable\Attributes\SearchQueryParam
  • Method JsonApiResponse::from can now be non-statically called as JsonApiResponse::using (for dependency injection usage in controllers, etc)

Changed

  • Config file changes. Please make sure to run php artisan vendor:publish --force --provider="OpenSoutheners\LaravelApiable\ServiceProvider"
  • Constructor from JsonApiResponse now only accepts 1 optional parameter (being the query parameter removed in favor of manually setting this by calling JsonApiResponse::using method)
  • Constructor from RequestQueryObject now only accepts 1 optional parameter (being the query parameter removed in favor of manually setting this by calling RequestQueryObject::setQuery method)
1.3.2

Added

  • JsonApiResponse:forceAppend method to force appends to the final response
1.3.1

Changed

  • JsonApiResponse::getPipelineQuery now accepts an optional callback closure & is exposed as public for repositories usage
1.3.0

Changed

  • RequestQueryObject::allowFilter method now accepts 3 arguments (attribute, operator/values, values)

Fixed

  • AllowedFilter::scopedValue method was removed and accidentally pushed onto RequestQueryObject::allowScopedFilter
1.2.0

Added

  • Method RequestQueryObject::allows to be able to group everything in the same method call without needing to use class methods (AllowedFilters, AllowedFields, etc...)
1.1.0

Added

  • AllowedFilter::scoped method for Laravel query scopes filters to specify the filter is not an actual attribute but a query builder scope
  • enforce_scoped_names to config/apiable.php to be used so they rename scoped filters in case there are attributes with the same name on the model (remember to use vendor:publish artisan command to update the config file)
  • include_allowed to config/apiable.php to be used so any JsonApiResponse will include allowed filters and sorts (like using JsonApiResponse::includeAllowedToResponse but on all requests)
  • AssertableJsonApi::hasNotAttribute and AssertableJsonApi::hasNotAttributes methods for negative test assertions (counter part of AssertableJsonApi::hasAttribute and AssertableJsonApi::hasAttributes)

Fixed

  • Scoped filters now can be allowed & applied to requested response
  • Issue with allowAppends & allowFields sending array of attributes will wrongly parse them
1.0.2

Added

  • Allowing fields and appends now accepts model class as for type parameter
1.0.1

Fixed

  • Missing publishable config
1.0.0

Removed

  • Custom transformers (out of package scope / purpose)

Fixed

  • Method allowIncludes adds nested array which leads into issues

Changed

  • Model setup not needed (OpenSoutheners\LaravelApiable\JsonApiOptions replaced by OpenSoutheners\LaravelApiable\Facades\Apiable::modelResourceTypeMap facade method)

Added

0.4.1

Fixed

  • Missing autoload-dev, tests were autoloaded with the released version
  • Multiple minor fixes around forwarding calls (methods)
  • Apiable facade toJsonApi
0.4.0

Added

  • Way to add multiple sorts and includes with allowSort & allowInclude methods
0.3.0

Added

  • JsonApiResponse getOne method for parse current model instance or model key passed
  • isCollection and isResource testing methods to AssertableJsonApi
0.2.0

Fixed

  • Multiple fixes to tests & package

Changed

  • Appends now needs to be sent as ?appends[type]=my_attribute,another_attribute as they're completely different from fields

Removed

  • JsonApiResource::withRelations() method (bad idea, lots of possible N+1 problems to the dev-user)
0.1.0

Added

  • Initial pre-release!
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai