NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #5106 most downloaded on Packagist
Laravel REST API helpers
Latest stable
10.5.6
Last release 20 days ago
02 Nov 2026
Release timing varies
gaps range from 8 days to 2 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
320 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
Paginator delegate to Laravel defaults.
Filters type. ` PostRepository::$match = [ 'title' => 'text', ]; `
PostRepository::$match = [
'title' => 'text',
];
{#1287
+"type": "text"
+"advanced": false
+"title": "Title"
+"description": ""
+"column": "title"
+"key": "matches"
}
Use column as a fallback for studly the title column. ie:
studly the title column. ie:array:6 [
"type" => "matchable"
"advanced" => false
"title" => "Approved At"
"description" => ""
"column" => "approved_at"
"key" => "matches"
]
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Make sure Advanced Filters are picked up #399
# Added - key for simple filters
key for simple filterspatch verb will now validate / authorize and update by attribute
patch verb will now validate / authorize and update by attributetitle, description and column so you can easily customize it. The full definition of an AdvancedFilter's looks like:
array:8 [
"type" => "multiselect"
"advanced" => true
"title" => "Status filter"
"description" => "Short description"
"column" => "status"
"key" => "status-filter"
"rules" => array:1 [
"status" => array:1 [
0 => "required"
]
]
"options" => array:1 [
0 => array:2 [
"label" => "Draft"
"property" => "draft"
]
]
]
Binaryk\LaravelRestify\Filters\MultiSelectFilter# Added - data helper typehint
data helper typehint# Fixed - Routes finding. - data helper now accept status.
data helper now accept status.Added PHP8 refactoring, type definitions.
AdvancedFilter.filters link to the index links list
filters link to the index links listRelated when null, should not use Builder.
` public static function matches(): array { return [ 'name' => MatchFilter::make() ->setType(RestifySearchable::MATCH_TEXT) ->partial(), 'code' => Mat
public static function matches(): array
{
return [
'name' => MatchFilter::make()
->setType(RestifySearchable::MATCH_TEXT)
->partial(),
'code' => MatchFilter::make()
->setType(RestifySearchable::MATCH_TEXT)
->strict(),
So now if your frontend will call:
/users?name=Johnthe search will return back even users with a name like: John Doe
If you are using ->strict() modifier, which is by default for all matches, then the API will search only for the name John.
related() { 'user' => BelongsTo::make('user', 'user', UserRepository::class)->searchable([ 'users.name' ]) } ```
// PostRepository
related() {
'user' => BelongsTo::make('user', 'user', UserRepository::class)->searchable([
'users.name'
])
}
So now your search will consider the users.name as well in a orWhere query:
?search=John Doe this will return you back all your posts where the belongs to user name has %John Doe%
name column, now it's dynamical.Now you can use a closure for the related:
related() : array
{
return [ 'owner' => fn() => 'John Doe'; ];
}
Image field now can use the ->default('image.png'), so if the image is not on the disk, it will fallback into it.
Image field now can use the ->default('image.png'), so if the image is not on the disk, it will fallback into it.Authorization configuration for the restifyjs.
` // Repository: $match = [ 'created_at' => RestifySearchable::MATCH_DATETIME_INTERVAL, ]; `
// Repository:
$match = [
'created_at' => RestifySearchable::MATCH_DATETIME_INTERVAL,
];
Query:
// Use isoString format
GET: /posts?created_at=created_at=2020-12-16T09:48:52.480645Z,2021-02-16T09:48:52.481004Z
This will filter by this interval.
You can also negate this by using - before the column name: -created_at=.
Sorting using BelongsTo field type. So now you can have:
// PostRepository
public static function sorts(): array
{
return [
'users.attributes.name' => SortableFilter::make()->setColumn('users.name')->usingBelongsTo(
BelongsTo::make('user', 'user', UserRepository::class),
)
];
}
And frontend can filter your posts by users.name using:
api/restify/posts?sort=users.attributes.name.
Fixed the php artisan restify:setup command issue with the config publishing.
php artisan restify:setup command issue with the config publishing.For the BelongsToMany, MorphToMany fields now you can specify validations rules using:
BelongsToMany, MorphToMany fields now you can specify validations rules using:BelongsToMany::make('roles', 'roles', RolesRepository::class)->validationCallback(fn(Request $request) => ....))
->unique() to BelongsToMany kind fields, so you can validate unicity of your pivot table entries.$withs property for repositories when force eager loading.Model guesser, so if you have ArticleRepository for example, Restify will guess the model App\Models\Article so you don't have to define the model sta
ArticleRepository for example, Restify will guess the model App\Models\Article so you don't have to define the model static property.Nothing published for this version
Nothing published for this version
Action logs - CRUD operations could be logged into your database (check the upgrade guideline to see how to benefit from this).
Handle action handle when query chunk is zero.
File and Image fields (#334)# Added - Scaffolding UserRepository.
# Added - Scaffolding UserRepository.
Default scaffold for repository and base repository.
Pivots on the show and index requests, they are now displayed in a pivots object.
pivots object.related of the repository.Fixed belongs to nullable relationship.
HasMany field fixed resolve method.
Fixed bug: get_class() expects parameter 1 to be object, null given
get_class() expects parameter 1 to be object, null given# Added - Added MorphOne field.
MorphOne field.Sorting by belongsTo relationship:
belongsTo relationship:Sometimes you may need to sort by a belongsTo relationship. This become a breeze with Restify. Firstly you have to
instruct your sort to use a relationship:
// PostRepository
use Binaryk\LaravelRestify\Fields\BelongsTo;
use Binaryk\LaravelRestify\Filters\SortableFilter;
public static function sorts(): array
{
return [
'users.name' => SortableFilter::make()
->setColumn('users.name')
->usingBelongsTo(
BelongsTo::make('user', 'user', UserRepository::class),
)
];
}
Make sure that the column is fully qualified (include the table name).
The request could look like:
GET: /api/restify/posts?sort=-users.name
This will return all posts, sorted descending by users name.
Support for integer column type for the artisan restify:stub command.
Support for integer column type for the artisan restify:stub command.
Support for managing related entities via Eager fields. For example, if you want to have in relationships an BelongsTo field:
//PostRepository.php
public static function getRelated()
{
return [
'owner' => BelongsTo::make('owner', 'owner', UserRepository::class),
];
}
Then you can get it via related as usual:
/api/restify/posts?related=owner
And the returned object in the relationships will be formatted using UserRepository fields, so you can attach policies and permissions for specific fields in the repository itself.
The format of filters related repository will include a new key:
'repository' => {
'key' => 'posts',
'url' => 'api/restify/posts',
'display_key' => 'id',
'title' => 'Posts'
}
You can implement a match filter definition, and specify for example related repository:
You can implement a match filter definition, and specify for example related repository:
public static $match = [
'title' => 'string',
'user_id' => MatchFilter::make()
->setType('int')
->setRelatedRepositoryKey(UserRepository::uriKey()),
];
When you will list this filter (with posts/filters?only=matches), you will get:
{
"class": "Binaryk\LaravelRestify\Filters\MatchFilter"
"key": "matches"
"type": "string"
"column": "title"
"options": []
},
{
"class": "Binaryk\LaravelRestify\Filters\MatchFilter"
"key": "matches"
"type": "int"
"column": "user_id"
"options": []
"related_repository_key": "users"
"related_repository_url": "//users"
}
Changed the method signature of the fromRelation and fromBuildermethods for the repository cast.
fromRelation and fromBuildermethods for the repository cast. abstract public static function fromBuilder(RestifyRequest $request, Builder $builder, Repository $repository): Collection;
abstract public static function fromRelation(RestifyRequest $request, Relation $relation, Repository $repository): Collection;
Support for using a custom related cast class (aka transformer). You can do so by modifying the restify.casts.related property. The default related ca
restify.casts.related property. The default related cast is Binaryk\LaravelRestify\Repositories\Casts\RelatedCast.The cast class should extends the Binaryk\LaravelRestify\Repositories\Casts\RepositoryCast abstract class.
Copy the default config to your restify.php configuration:
'casts' => [
/*
|--------------------------------------------------------------------------
| Casting the related entities format.
|--------------------------------------------------------------------------
|
*/
'related' => \Binaryk\LaravelRestify\Repositories\Casts\RelatedCast::class,
],
Fix: Fallback for plain related values
Mock data generator: php artisan restify:stub users --count=10 now support relations
php artisan restify:stub users --count=10 now support relationsAnd much much more, see official documentation.
Nothing published for this version
## Added Support for Laravel 8
Sometimes you don't need to have an action with models. Let's say for example the authenticated user wants to disable his account. For this we have st
Sometimes you don't need to have an action with models. Let's say for example the authenticated user wants to disable his account. For this we have standalone actions:
// UserRepository
public function actions(RestifyRequest $request)
{
return [
DisableProfileAction::new()->standalone(),
];
}
Usually the URL for the action is make based on the action name. You can use your own URI key if you want:
class DisableProfileAction extends Action
{
public static $uriKey = 'disable_profile';
//...
}
mainQuery on repositories, now you can use this for show and index endpoints
mainQuery on repositories, now you can use this for show and index endpointsBinaryk\LaravelRestify\Models\CreationAware interface. Now you can extend it, and you will take the control over the model savingLoading relationship from memory (eagers)
Adding new validation support for Unique
## Patch Fixing filter. ## Added - booted method for repositories
Fixing filter.
You can use the UserRepository (if you have one), to resolve the profile and perform the updates over the profile by using the UserProfile trait in yo
You can use the UserRepository (if you have one), to resolve the profile and perform the updates over the profile by using the UserProfile trait in your repository:
class UserRepository extends Repository
{
use Binaryk\LaravelRestify\Repositories\UserProfile;
}
Checkout the documentation for more details.
Match by datetime `php class PostRepository extends Repository { public static $match = [ 'published_at' => RestifySearchable::MATCH_DATETIME, ]; } `
class PostRepository extends Repository
{
public static $match = [
'published_at' => RestifySearchable::MATCH_DATETIME,
];
}
Request:
GET: /restify-api/posts?published_at=2020-12-01
class PostRepository extends Repository
{
public static $match = [
'published_at' => RestifySearchable::MATCH_ARRAY,
];
}
Request:
GET: /restify-api/posts?id=1,2,3
This will be converted to:
->whereIn('id', [1, 2, 3])
GET: /restify-api/posts?-id=1,2,3
This will return all posts where doesn't have the id in the [1,2,3] list.
You can apply - (negation) for every match:
GET: /restify-api/posts?-title="Some title"
This is very wanted feature, for a long time.
This is very wanted feature, for a long time.
Before:
After:
`bash POST: restify-api/posts/bulk `
POST: restify-api/posts/bulk
Payload:
[ { "title": "Post title 1"}, { "title": "Post title 2"} ]
This is as well post. Just because using "POST" you can pass form data:
POST: restify-api/posts/bulk/update
Payload:
[ { "id":1, "title": "Post title 1"}, { "id": 2, "title": "Post title 2"} ]
However, Laravel Restify provides eager loading based on the query related property, you may want to force eager load a relationship in terms of using
However, Laravel Restify provides eager loading based on the query related property,
you may want to force eager load a relationship in terms of using it in fields, or whatever else:
// UserRepository.php
public static $with = ['posts'];
RestResponse static index method, so you can return the same format for a custom paginator.
index method, so you can return the same format for a custom paginator.$paginator = User::query()->paginate(5);
$response = Binaryk\LaravelRestify\Controllers\RestResponse::index(
$paginator
);
resolveIndexMainMeta method, now it accept the paginatorMeta information:public function resolveIndexMainMeta(RestifyRequest $request, Collection $items, array $paginationMeta): array
You can also override the main meta object for the index, not the one for per item:
You can also override the main meta object for the index, not the one for per item:
public function resolveIndexMainMeta(RestifyRequest $request, Collection $items)
{
$default = parent::resolveIndexMeta($request);
return array_merge($default, [
'next_payment_at' => $this->resource->current_payment_at->addMonth(),
]);
}
Ability to setup your own attachers. For example if you want to attach users to a role, and you don't want to use the default attach method. In this c
Ability to setup your own attachers. For example if you want to attach users to a role, and you don't want to use the default attach method. In this case you can override the attach method like this:
// RoleRepository.php
public function attachUsers(RestifyRequest $request, Repository $repository, Model $model)
{
ModelHasRole::create([
'role_id' => $model->id,
'model_type' => User::class,
'model_id' => $request->get('users'),
]);
return $this->response()->created();
}
The URL used for attach will remain the same as for a normal attach:
'restify-api/roles/' . $role->id . '/attach/users'
Handler HttpException returns now the correct code
Possibility to add custom middleware the repository level:
public static $middlewares = [
PostAbortMiddleware::class,
];
or if you need RestifyRequest you can override the collecting method:
public static function collectMiddlewares(RestifyRequest $request): ?Collection
{
if ($request->isStoreRequest()) {
return collect([PostAbortMiddleware::class]);
}
}
attributes property.User full url for the avatar after updating avatar
Profile endpoint GET:restify/profile
restify/profilerestify/profilerestify/profile/avatarYou can customize the user avatar column by using:
Binaryk\LaravelRestify\Http\Requests\ProfileAvatarRequest::$userAvatarAttribute = 'avatar';
You can also customize the path to the file using:
Binaryk\LaravelRestify\Http\Requests\ProfileAvatarRequest::$path = 'avatars';
or if you need current request:
Binaryk\LaravelRestify\Http\Requests\ProfileAvatarRequest::$usingPath = function (RestifyRequest $request) {
return "avatars/{$user->id}";
}
One column per quarter.