Open Source • Laravel Package • MIT Licensed

Build APIs for
Humans & AI
Simultaneously

Transform your Laravel Eloquent models into JSON:API endpoints and MCP servers automatically.

Zero boilerplate. Pure results. Future-ready architecture.

install
Input
// 1. Create your repository
class PostRepository extends Repository
{
    public static string $model = Post::class;
}
// 2. Enable MCP for AI agents
Mcp::web('restify', RestifyServer::class);
Output
REST API
GET/api/restify/posts
POST/api/restify/posts
PATCH/api/restify/posts/{id}
DELETE/api/restify/posts/{id}
MCP TOOLS
🤖 posts-index-tool
🤖 posts-create-tool
🤖 posts-update-tool
🤖 posts-delete-tool
Zero Config
🚀
JSON:API
🤖
AI Ready
💎
Laravel Native
🤖 AI-Powered Installation

Install with AI

Copy this prompt and paste it into Claude, ChatGPT, or any AI assistant

Install with AI
## Install Laravel Restify in my Laravel project

Please help me install and set up Laravel Restify, a package that transforms Laravel Eloquent models into JSON:API endpoints and MCP servers for AI agents.

### Step 1: Install the package

Run this command in your terminal:

```shell
composer require binaryk/laravel-restify
```

### Step 2: Run the setup command

After installation, scaffold the API structure:

```shell
php artisan restify:setup
```

This command will:
- Publish the `config/restify.php` configuration file
- Create `providers/RestifyServiceProvider` and register it
- Create the `app/Restify` directory for repositories
- Generate an abstract `app/Restify/Repository.php` base class
- Scaffold `app/Restify/UserRepository` for immediate use
- Create `routes/ai.php` with commented MCP server configuration

### Step 3: Run migrations

Complete the setup by running migrations:

```shell
php artisan migrate
```

### Step 4: Test the API

Your API is now ready! Test it with:

```bash
GET /api/restify/users?perPage=10&page=1
```

### Step 5 (Optional): Enable MCP Server for AI Agents

To make your API accessible to AI agents like Claude Desktop:

1. Add the MCP server to your `config/ai.php` file:

```php
use Binaryk\LaravelRestify\MCP\RestifyServer;
use Laravel\Mcp\Facades\Mcp;

Mcp::web('restify', RestifyServer::class)
    ->middleware(['auth:sanctum'])
    ->name('mcp.restify');
```

2. Enable MCP tools in your repositories by adding the `HasMcpTools` trait:

```php
use Binaryk\LaravelRestify\MCP\Concerns\HasMcpTools;

#[Model(User::class)]
class UserRepository extends Repository
{
    use HasMcpTools; // Enables MCP tools for AI agents

    public function fields(RestifyRequest $request): array
    {
        return [
            field('name')->required(),
            field('email')->required(),
        ];
    }
}
```

### Next Steps

After installation, please help me:
- Understand what was created during setup
- Learn how to create my first repository
- Test the API endpoints
- Optionally configure authentication with Sanctum

For more information, visit the Laravel Restify documentation at https://restify.binarcode.com

This prompt will guide an AI assistant to help you install and set up Laravel Restify in your project.

One Codebase, Infinite Possibilities

Write Once,
Deploy Everywhere

Transform your Laravel models into production-ready APIs and AI-compatible servers with zero configuration. The future of API development is here.

JSON:API Compliant

Automatically generates endpoints that follow JSON:API specifications with proper relationships, pagination, filtering, and sparse fieldsets.

{
  "data": {
    "id": "1",
    "type": "posts",
    "attributes": {
      "title": "Laravel Restify",
      "published_at": "2024-01-15"
    },
    "relationships": {
      "author": {
        "data": {"id": "1", "type": "users"}
      }
    }
  }
}
Policy-Based Auth

Built-in integration with Laravel's authorization system. Use policies for fine-grained access control on every endpoint.

class PostPolicy
{
    public function index(User $user)
    {
        return $user->can('view posts');
    }
    
    public function store(User $user)
    {
        return $user->hasRole('admin');
    }
}
Smart Filtering

Complex queries, sorting, filtering, and search across relationships without any extra configuration.

GET /api/restify/posts?
  filter[title]=Laravel&
  filter[status]=published&
  sort=-created_at&
  include=author,comments&
  page[size]=10
AI Agent Ready

Generate Model Context Protocol servers that allow AI agents to interact with your APIs using structured, type-safe tools.

// Enable MCP for AI agents
Mcp::web('restify', RestifyServer::class)
    ->middleware(['auth:sanctum'])
    ->name('mcp.restify');
Zero Configuration

Start building in seconds. Just create a repository class pointing to your model and you're ready.

class UserRepository extends Repository
{
    public static string $model = User::class;
    
    // That's it! Full CRUD API ready 🚀
}
Laravel Native

Built specifically for Laravel, leveraging Eloquent ORM, Service Container, and all Laravel conventions.

// Works with Laravel middleware
Route::middleware('auth:sanctum')
    ->group(function () {
        Route::restify();
    });
Join the Revolution

Built by Developers,
for Developers

Laravel Restify is open source and community-driven. Join thousands of developers who are building the future of API development.

Open Source

MIT licensed, completely free, and transparently developed on GitHub with full source code access.

Star on GitHub

Documentation

Comprehensive guides, tutorials, and API reference with real-world examples and best practices.

Read Docs

Discussions

Get help, share ideas, and connect with other developers in our active GitHub Discussions community.

Join Discussion
B

BinarCode

Proudly maintained by BinarCode, a team passionate about Laravel and modern web development.

Visit Website
1K+
GitHub Stars
50K+
Downloads
100+
Contributors
5+
Years Active

Built by Amazing Contributors

Laravel Restify is made possible by our incredible community of contributors who help make it better every day

binaryk
binaryk (940)
arthurkirkosa
arthurkirkosa (26)
CaReS0107
CaReS0107 (9)
dsindrilaru
dsindrilaru (6)
daniel-banciulea
daniel-banciulea (4)
cristijora
cristijora (2)
maicol07
maicol07 (2)
ttungbmt
ttungbmt (2)
gabrielpetrescu
gabrielpetrescu (2)
adam-code-labx
adam-code-labx (1)
alexstewartja
alexstewartja (1)
Nonines
Nonines (1)
Eighke
Eighke (1)
ManukMinasyan
ManukMinasyan (1)
msucevan
msucevan (1)
binaryk
binaryk (940)
arthurkirkosa
arthurkirkosa (26)
CaReS0107
CaReS0107 (9)
dsindrilaru
dsindrilaru (6)
daniel-banciulea
daniel-banciulea (4)
cristijora
cristijora (2)
maicol07
maicol07 (2)
ttungbmt
ttungbmt (2)
gabrielpetrescu
gabrielpetrescu (2)
adam-code-labx
adam-code-labx (1)
alexstewartja
alexstewartja (1)
Nonines
Nonines (1)
Eighke
Eighke (1)
ManukMinasyan
ManukMinasyan (1)
msucevan
msucevan (1)
Start Building Today

Ready to build
amazing APIs?

Install Laravel Restify today and transform your API development experience with elegant, powerful, and intuitive tools.

Install via Composer

Get started instantly with Composer package manager

$ composer require binaryk/laravel-restify
Clone from GitHub

Explore the source code and contribute

$ git clone https://github.com/BinarCode/laravel-restify.git