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.
fixing store and update via mcp (#655) (Lupacescu Eduard)
Support for ->description() for fields.
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →
## Fixed - Fixed sortable default
Laravel Restify now provides seamless integration with the Model Context Protocol (MCP), allowing AI agents to interact with your REST API resources t
Laravel Restify now provides seamless integration with the Model Context Protocol (MCP), allowing AI agents to interact with your REST API resources through structured tool interfaces. Transform your repositories into tools for AI agents to consume!
Quick Setup:
use Binaryk\LaravelRestify\MCP\RestifyServer;
use Laravel\Mcp\Facades\Mcp;
// Web-based MCP server with authentication
Mcp::web('restify', RestifyServer::class)
->middleware(['auth:sanctum'])
->name('mcp.restify');
Key Benefits: AI-Ready APIs, Zero Configuration, Built-in Security, Web & Terminal Access
📖 Complete MCP Documentation →
Fields can now be configured to lazy load relationships, preventing N+1 queries for computed attributes:
field('profileTagNames', fn() => $this->model()->profileTagNames)
->lazy('tags'),
📖 Lazy Loading Documentation →
Performance optimization replacing slow subqueries with efficient JOIN operations. Enable via configuration:
// config/restify.php
'search' => [
'use_joins_for_belongs_to' => env('RESTIFY_USE_JOINS_FOR_BELONGS_TO', false),
],
📖 Performance Optimization Guide →
Powerful caching system for repository index requests that can improve response times by orders of magnitude. Features smart cache key generation, automatic invalidation, and support for all major cache stores.
# Enable in .env
RESTIFY_REPOSITORY_CACHE_ENABLED=true
RESTIFY_REPOSITORY_CACHE_TTL=300
RESTIFY_REPOSITORY_CACHE_STORE=redis
Key Features:
Performance Impact:
// Repository-specific configuration
class PostRepository extends Repository {
public static int $cacheTtl = 600; // 10 minutes
public static array $cacheTags = ['posts', 'content'];
}
📖 Repository Caching Documentation →
New and improved field methods with flexible signatures:
searchable() - Unified flexible signature with multiple argument supportmatchable() - Various match types and advanced filtering scenariossortable() - Custom columns and conditional sortingFields now include 60+ validation methods for streamlined form validation without manually writing Laravel validation rules:
// Basic validations
field('email')->required()->email(),
field('age')->integer()->min(18)->max(100),
field('password')->string()->min(8)->confirmed(),
// Advanced validations
field('username')->alphaDash()->uniqueRule('users'),
field('website')->url()->nullable(),
field('birthday')->date()->before('today'),
field('role')->in(['admin', 'user', 'moderator']),
field('ip_address')->ip(),
field('uuid')->uuid(),
field('json_data')->json(),
// Conditional validations
field('phone')->requiredIf('contact_method', 'phone'),
field('company')->requiredWith(['is_business']),
field('start_date')->after('created_at'),
field('end_date')->afterOrEqual('start_date'),
Available Methods: required(), nullable(), email(), numeric(), integer(), boolean(), string(), array(), url(), uuid(), ip(), ipv4(), ipv6(), min(), max(), between(), uniqueRule(), exists(), confirmed(), password(), regex(), size(), accepted(), json(), alpha(), alphaNum(), alphaDash(), date(), datetime(), dateFormat(), after(), afterOrEqual(), before(), beforeOrEqual(), different(), same(), filled(), present(), isFile(), isImage(), in(), notIn(), requiredIf(), requiredUnless(), requiredWith(), requiredWithAll(), requiredWithout(), requiredWithoutAll(), multipleOf(), timezone(), currentPassword(), macAddress(), endsWith(), startsWith()
BelongsTo fields now support custom search callbacks for complete control over search behavior:
BelongsTo::make('user')->searchable(function ($query, $request, $value, $field, $repository) {
return $query->whereHas('user', function ($q) use ($value) {
$q->where('name', 'ilike', "%{$value}%")
->orWhere('email', 'ilike', "%{$value}%");
});
})
The callback receives all necessary parameters with the query as the first parameter for maximum flexibility.
📖 Field Methods Documentation →
Repositories no longer search by primary key (ID) by default when no searchable fields are defined.
Migration Path:
public static function searchables(): array {
return empty(static::$search) ? [static::newModel()->getKeyName()] : static::$search;
}
Revert https://github.com/BinarCode/laravel-restify/pull/638
get query matches from input so we can append in the mcp server #642
Fixed https://github.com/BinarCode/laravel-restify/issues/640
feat: allow returning array from the index method repository (this enhances Ai Tools to consume Restify)
fix(Match): Allow bool false for BOOL match
fix(Matches): Correctly match Booleans: GET converts them to 0 and 1 #632
Authenticate the user while login
Improved error AI solutions #628
fixing defaultCallback method on fields #627
Make sure to publishing on Laravel 12 exposes Restify provider.
## Added - Support for Laravel 12
fix(Search): Correctly search for strings with quotes and double quotes
Add groupBy as a new feature in repositor https://github.com/BinarCode/laravel-restify/pull/622
Collect related when serialize for js
During any (update or store requests), this is called after the fill and store callbacks.
During any (update or store requests), this is called after the fill and store callbacks.
You can pass a callable or a value, and it will be attached to the model if no value provided otherwise.
Imagine it's like attributes in the model:
field('currency')->defaultCallback('EUR')
Nothing published for this version
## Fixed - Missing Str class
Support for string (full URL) for file() fields.
fix(Bulk Update): Only Validate Data for Current Item in Loop #612
Starting from version 9.3.0, Laravel Restify introduces the ability to apply advanced filters using a POST request. This enhancement simplifies the pr
Starting from version 9.3.0, Laravel Restify introduces the ability to apply advanced filters using a POST request. This enhancement simplifies the process of sending complex filter payloads without the need for base64 encoding. Now, you can send the filters directly as JSON in the request body:
const filters = [
{
'key': 'ready-posts-filter',
'value': null,
}
];
const response = await axios.post(`api/restify/posts/apply-restify-advanced-filters`, { filters });
In some scenarios, you might want to send additional data beyond the standard key and value in your filter payload. For instance, you may need to spec
In some scenarios, you might want to send additional data beyond the standard key and value in your filter payload. For instance, you may need to specify an operator or a column to apply more complex filtering logic. Laravel Restify Advanced Filters provide a way to handle these additional payload fields using the $this->rest() method.
Example Payload
Consider the following payload:
const filters = btoa(JSON.stringify([
{
'key': ValueFilter::uriKey(),
'value': 'Valid%',
'operator' => 'like',
'column' => 'description',
}
]));
const response = await axios.get(`api/restify/posts?filters=${filters}`);
In this payload, besides the standard key and value, we are also sending operator and column. The operator specifies the type of SQL operation, and the column specifies the database column to filter.
Using $this->rest() to Access Additional Data
To handle these additional fields in your filter class, you need to ensure they are accessible via the $this->rest() method. Here is how you can achieve that:
class ValueFilter extends AdvancedFilter
{
public function filter(RestifyRequest $request, Builder|Relation $query, $value)
{
$operator = $this->rest('operator');
$column = $this->rest('column');
$query->where($column, $operator, $value);
}
public function rules(Request $request): array
{
return [];
}
}
Ability to cache single policy #605
Restify allows individual caching at the policy level with specific configurations. To enable this, a contract Cacheable must be implemented at the policy level, which enforces the use of the cache() method.
class PostPolicy implements Cacheable
{
public function cache(): ?CarbonInterface
{
return now()->addMinutes();
}
The cache method is expected to return a CarbonInterface or null. If null is returned, the current policy will NOT cached.
## Added - Add support for Laravel 11
## Added - Add support for Laravel 11
Restifyjs setup without auth middleware
Support for https://github.com/php/php-src/pull/12959
Support searching string with single quotes in them #592
fix: rules method overrides already defined rules #575
Fixed accept string in filters #585
## Fixed - Fixed type for resolver #584
## Fixed - sortable filter update #583
## Fixed - change the route name
Invokable Getters https://restify.binarcode.com/api/getters/#invokable-getter-format
## Fixed - docs for getters #554
Introduces a new option to publish specific auth actions #551
artisan restify:routes commentSupport for actionable fields on PATCH method #547
thanks @dsindrilaru
Now you can use the permission name for the field see authorization:
field('user_id')->canSeeWhen('can manage users'),
## Fixed - Do not display hidden pivots.
fix: do not filter belongs to many fields
Return a collection with only its values, without any keys or indexes (if it's an associative array). https://github.com/BinarCode/laravel-restify/iss
Show the full path for the file when suggesting OpenAI solution.
Inspired and thanks to Marcel for the article: https://beyondco.de/blog/ai-powered-error-solutions-for-laravel
Inspired and thanks to Marcel for the article: https://beyondco.de/blog/ai-powered-error-solutions-for-laravel
Restify can generate an AI based solution to your problem. In order to enable that you need to extend the App\Exceptions\Handler with the Binaryk\LaravelRestify\Exceptions\RestifyHandler:
use Binaryk\LaravelRestify\Exceptions\RestifyHandler;
use Throwable;
class Handler extends RestifyHandler
{
//...
}
<alert type="warning">
This feature is only enabled when the app.debug is set to true.
</alert>
This feature is using the openai-php/laravel, you should also publish the config file:
php artisan vendor:publish --provider="OpenAI\Laravel\ServiceProvider"
and set the OPENAI_API_KEY in the .env file.
The OpenAI key can be obtained from here.
Now the solution to your problems will automatically appear in the response:
{
"restify-solution": "Line 67 in DocumentRepository.php file has an error because the method `resolveUsingFullPath()` is not defined. The code should look like this:\n```\n->resolveUsingTemporaryUrl($request->boolean('temporary'))\n```\n",
"message": "Call to undefined method Binaryk\\LaravelRestify\\Fields\\File::resolveUsingFullPath()",
"exception": "Error",
"file": "/Users/eduardlupacescu/Sites/binarcode/erp/app/Restify/DocumentRepository.php",
"line": 67,
"trace": [
...
}
If you want to disable the solution feature you can set the restify.ai_solution to false in the config/restify.php file so Restify will not call the OpenAI API even you extended the exception handler. This might be useful in automated tests or other environments:
// config/restify.php
'ai_solutions' => true,
By default, Restify will display the file's stored path name. However, you may customize this behavior.
By default, Restify will display the file's stored path name. However, you may customize this behavior.
For disks such as S3, you may instruct Restify to display a temporary URL to the file instead of the stored path name:
field('path')
->file()
->path("documents/".Auth::id())
->resolveUsingTemporaryUrl()
->disk('s3'),
The resolveUsingTemporaryUrl accepts 3 arguments:
$resolveTemporaryUrl - a boolean to determine if the temporary url should be resolved. Defaults to true.
$expiration - A CarbonInterface to determine the time before the URL expires. Defaults to 5 minutes.
$options - An array of options to pass to the temporaryUrl method of the Illuminate\Contracts\Filesystem\Filesystem implementation. Defaults to an empty array.
For disks such as public, you may instruct Restify to display a full URL to the file instead of the stored path name:
field('path')
->file()
->path("documents/".Auth::id())
->resolveUsingFullUrl()
->disk('public'),
Now you can add a placeholder to the filter, so it renders on the frontend
'title' => MatchFilter::make()
->setDescription('Sort by title')
->setPlaceholder('-title')
->setType('string')
When we read match filters using: `/api/restify/posts/filters?only=matches` we will get:
[
"type" => "string"
"advanced" => false
"title" => "Title"
"description" => "Sort by title"
"placeholder" => "-title"
"column" => "title"
"key" => "matches"
]
## Fixed - Profile request class
Remove Email Exist validation #518
You can also sync your BelongsToMany field. Say you have to sync permissions to a role. You can do it like this:
You can also sync your BelongsToMany field. Say you have to sync permissions to a role. You can do it like this:
POST: api/restify/roles/1/sync/permissions
Payload:
{
"permissions": [1, 2]
}
Under the hood this will call the sync method on the BelongsToMany relationship:
// $role of the id 1
$role->permissions()->sync($request->input('permissions'));
You can define a policy method syncPermissions. The name should start with sync and suffix with the plural CamelCase name of the model's relationship name:
// RolePolicy.php
public function syncPermissions(User $authenticatedUser, Company $company, Collection $keys): bool
{
// $keys are the primary keys of the related model (permissions in our case) Restify is trying to `sync`
}
The rest method will consider the meta information for the rest helper: rest($user)->indexMeta(['token' => $token])
rest($user)->indexMeta(['token' => $token])Belongs search with custom foreign key https://github.com/BinarCode/laravel-restify/pull/512
Inherited https://github.com/BinarCode/laravel-restify/releases/tag/6.12.2
Serializer - Serialize One model or nothing using the show response format #510
The policyMeta method is now protected at the repository level (it could be used to override the policy information for the show and index methods.
policyMeta method is now protected at the repository level (it could be used to override the policy information for the show and index methods.RelatedDto as a singleton in a test environment (this causes issues when trying to make few relationship requests to the same repository in the same test)action, route and getters).The unauthorized code should be 401.
The testing Repository::route( method has a new signature, it accepts the action as well now.
Repository::route( method has a new signature, it accepts the action as well now.Cache enable option is considered during the policy methods check.
Action logs should be enabled now.
One column per quarter.