PHPackages                             binaryk/laravel-restify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. binaryk/laravel-restify

ActiveLibrary[HTTP &amp; Networking](/categories/http)

binaryk/laravel-restify
=======================

Laravel REST API helpers

10.4.6(2mo ago)651399.1k—7.1%60MITPHPPHP ^8.3CI passing

Since Dec 23Pushed 2mo ago9 watchersCompare

[ Source](https://github.com/BinarCode/laravel-restify)[ Packagist](https://packagist.org/packages/binaryk/laravel-restify)[ Docs](https://github.com/BinarCode/laravel-restify)[ RSS](/packages/binaryk-laravel-restify/feed)WikiDiscussions 10.x Synced 1mo ago

READMEChangelog (10)Dependencies (36)Versions (286)Used By (0)

[![](/docs-v2/static/logo.png)](/docs-v2/static/logo.png)

 [![Build Status](https://github.com/BinarCode/laravel-restify/actions/workflows/tests.yml/badge.svg)](https://github.com/BinarCode/laravel-restify/actions) [![Total Downloads](https://camo.githubusercontent.com/5b4947e849bc756e2769ddb9fe63c9d6b28ee560e300bcd7ccba21dc72399d23/68747470733a2f2f706f7365722e707567782e6f72672f62696e6172796b2f6c61726176656c2d726573746966792f642f746f74616c2e737667)](https://packagist.org/packages/binaryk/laravel-restify) [![Latest Stable Version](https://camo.githubusercontent.com/7c71a5089d16089753d200fd32db0950a092e97af9f2f4148531eaf2f17c0762/68747470733a2f2f706f7365722e707567782e6f72672f62696e6172796b2f6c61726176656c2d726573746966792f762f737461626c652e737667)](https://packagist.org/packages/binaryk/laravel-restify) [![License](https://camo.githubusercontent.com/03a348db5de7d6ce8b3d1cb12bb172966234620839a8ba228dda9341cdf6bf93/68747470733a2f2f706f7365722e707567782e6f72672f62696e6172796b2f6c61726176656c2d726573746966792f6c6963656e73652e737667)](https://packagist.org/packages/binaryk/laravel-restify)

Unified Laravel API Layer for Humans and AI
===========================================

[](#unified-laravel-api-layer-for-humans-and-ai)

**One Codebase. REST for Humans, MCP for AI Agents.**

Laravel Restify turns your Eloquent models into both JSON:API endpoints and MCP servers -- automatically. Build once, and instantly serve APIs that work seamlessly for developers, apps, and AI agents.

🚀 The Power of One Codebase
---------------------------

[](#-the-power-of-one-codebase)

Traditional API development requires separate implementations for different consumers. Laravel Restify changes that:

- **👥 Humans** get full-featured JSON:API endpoints
- **🤖 AI Agents** get structured MCP (Model Context Protocol) servers
- **🔒 Same Rules** - All authentication, authorization, and policies apply to both
- **📝 One Definition** - Write your repository once, serve everywhere

Key Features
------------

[](#key-features)

- **JSON:API Endpoints** - Full [JSON:API](https://jsonapi.org) specification compliance
- **MCP Server Generation** - Automatic AI agent interfaces with tool definitions
- **Unified Authorization** - Laravel policies protect both human and AI access
- **Search &amp; Filtering** - Powerful query capabilities for all consumers
- **Authentication** - Laravel Sanctum integration for secure access
- **GraphQL Support** - Auto-generated GraphQL schemas
- **Field Validation** - Consistent validation rules across all interfaces

Installation
------------

[](#installation)

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

Quick Start
-----------

[](#quick-start)

**1. Setup the package:**

```
php artisan restify:setup
```

**2. Create your first repository:**

```
php artisan restify:repository PostRepository --all
```

**3. Enable MCP for AI agents (optional):**

Add to your `config/ai.php`:

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

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

**That's it!** Your API now serves both:

**For Humans (JSON:API):**

```
GET /api/restify/posts
POST /api/restify/posts
PUT /api/restify/posts/1
DELETE /api/restify/posts/1
```

**For AI Agents (MCP):**

```
GET /mcp/restify  # Tool definitions and capabilities
```

Example Repository
------------------

[](#example-repository)

```
use Binaryk\LaravelRestify\Http\Requests\RestifyRequest;
use Binaryk\LaravelRestify\Repositories\Repository;
use Binaryk\LaravelRestify\Attributes\Model;

#[Model(Post::class)]
class PostRepository extends Repository
{
    public function fields(RestifyRequest $request): array
    {
        return [
            field('title')->rules('required', 'string', 'max:255'),
            textarea('content')->rules('required'),
            field('author')->readonly(),
            datetime('published_at')->nullable(),
        ];
    }
}
```

This single definition automatically provides:

- ✅ JSON:API CRUD endpoints with validation
- ✅ MCP tools for AI agents with the same validation
- ✅ Authorization policies applied to both interfaces
- ✅ Search and filtering capabilities for all consumers

One Codebase, Two Outputs
-------------------------

[](#one-codebase-two-outputs)

Here's what you get from one repository definition:

### For Humans (JSON:API Response)

[](#for-humans-jsonapi-response)

```
GET /api/restify/posts
```

```
{
  "data": [
    {
      "id": "1",
      "type": "posts",
      "attributes": {
        "title": "Laravel Restify Guide",
        "content": "Build APIs fast...",
        "published_at": "2024-01-15"
      }
    }
  ],
  "links": {
    "self": "/api/restify/posts",
    "next": "/api/restify/posts?page=2"
  }
}
```

### For AI Agents (MCP Tool Definition)

[](#for-ai-agents-mcp-tool-definition)

```
GET /mcp/restify  # Tool definitions for AI agents
```

```
{
  "tools": [
    {
      "name": "posts-index-tool",
      "description": "Retrieve a paginated list of Post records from the posts repository with filtering, sorting, and search capabilities.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "page": {
            "type": "number",
            "description": "Page number for pagination"
          },
          "perPage": {
            "type": "number",
            "description": "Number of posts per page"
          },
          "search": {
            "type": "string",
            "description": "Search term to filter posts by title or content"
          },
          "sort": {
            "type": "string",
            "description": "Sorting criteria (e.g., sort=title or sort=-published_at for descending)"
          },
          "title": {
            "type": "string",
            "description": "Filter by exact match for title (e.g., title=Laravel). Accepts negation with -title=value"
          },
          "published_at": {
            "type": "string",
            "description": "Filter by publication date (e.g., published_at=2024-01-15)"
          }
        }
      }
    }
  ]
}
```

**All generated from this simple repository:**

```
#[Model(Post::class)]
class PostRepository extends Repository
{
    use HasMcpTools;

    public function fields(RestifyRequest $request): array
    {
        return [
            field('title')->required()->matchable(),
            field('content'),
            field('published_at')->rules('date')->matchable(),
        ];
    }
}
```

Restify Boost
-------------

[](#restify-boost)

**Laravel Restify Boost** is a development companion that provides MCP server capabilities to help you build Restify APIs faster with AI assistance.

**Repository:** [laravel-restify-boost](https://github.com/BinarCode/laravel-restify-boost)

**Features:**

- Documentation access for AI agents
- Repository and action generation assistance
- Code examples and best practices
- Integration with Claude Desktop and other AI tools

**Installation:**

```
composer require --dev binarcode/laravel-restify-boost
```

Templates
---------

[](#templates)

Need a production-ready starting point? Check out [Restify Templates](https://restifytemplates.com) for complete API starter kits with authentication, permissions, and team management.

Resources
---------

[](#resources)

- **[Documentation](https://laravel-restify.com)** - Complete guides and API reference
- **[Demo Repository](https://github.com/BinarCode/restify-demo)** - Working example
- **[Video Course](https://www.binarcode.com/learn/restify)** - Visual learning resource

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Eduard Lupacescu](https://twitter.com/LupacescuEuard)
- [Koen Koenster](https://github.com/Koenster)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

70

—

ExcellentBetter than 100% of packages

Maintenance85

Actively maintained with recent releases

Popularity57

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

258

Last Release

78d ago

Major Versions

6.12.1 → 7.0.02022-07-24

6.x-dev → 7.6.02022-09-15

7.11.0 → 8.0.02023-03-26

8.x-dev → 9.0.02024-04-01

9.x-dev → 10.0.02025-08-28

PHP version history (8 changes)1.0.0PHP ^7.1

2.4.0PHP ^7.4

4.9.0PHP ^7.4|^8.0

5.0.0PHP ^8.0

8.0.0PHP ^8.1

8.4.0PHP ^8.2

10.0.0PHP ^8.2|^8.3

10.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/dfbb03bb93526135d948c1232c28938180a944e65362263dda08545afa3fee6d?d=identicon)[binaryk](/maintainers/binaryk)

---

Top Contributors

[![binaryk](https://avatars.githubusercontent.com/u/6833714?v=4)](https://github.com/binaryk "binaryk (973 commits)")[![arthurkirkosa](https://avatars.githubusercontent.com/u/1099791?v=4)](https://github.com/arthurkirkosa "arthurkirkosa (31 commits)")[![denisdobra10](https://avatars.githubusercontent.com/u/82820448?v=4)](https://github.com/denisdobra10 "denisdobra10 (13 commits)")[![CaReS0107](https://avatars.githubusercontent.com/u/32643188?v=4)](https://github.com/CaReS0107 "CaReS0107 (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![dsindrilaru](https://avatars.githubusercontent.com/u/87819215?v=4)](https://github.com/dsindrilaru "dsindrilaru (6 commits)")[![daniel-banciulea](https://avatars.githubusercontent.com/u/29707399?v=4)](https://github.com/daniel-banciulea "daniel-banciulea (4 commits)")[![george-todica](https://avatars.githubusercontent.com/u/13329027?v=4)](https://github.com/george-todica "george-todica (4 commits)")[![cristijora](https://avatars.githubusercontent.com/u/15955045?v=4)](https://github.com/cristijora "cristijora (3 commits)")[![gabrielpetrescu](https://avatars.githubusercontent.com/u/33344024?v=4)](https://github.com/gabrielpetrescu "gabrielpetrescu (2 commits)")[![maicol07](https://avatars.githubusercontent.com/u/9463142?v=4)](https://github.com/maicol07 "maicol07 (2 commits)")[![RomainMazB](https://avatars.githubusercontent.com/u/53976837?v=4)](https://github.com/RomainMazB "RomainMazB (2 commits)")[![ttungbmt](https://avatars.githubusercontent.com/u/12232155?v=4)](https://github.com/ttungbmt "ttungbmt (2 commits)")[![Nonines](https://avatars.githubusercontent.com/u/105732838?v=4)](https://github.com/Nonines "Nonines (1 commits)")[![rizkyseptiawan](https://avatars.githubusercontent.com/u/37582788?v=4)](https://github.com/rizkyseptiawan "rizkyseptiawan (1 commits)")[![robin-dongbin](https://avatars.githubusercontent.com/u/24680921?v=4)](https://github.com/robin-dongbin "robin-dongbin (1 commits)")[![adam-code-labx](https://avatars.githubusercontent.com/u/53559175?v=4)](https://github.com/adam-code-labx "adam-code-labx (1 commits)")[![yondifon](https://avatars.githubusercontent.com/u/35140079?v=4)](https://github.com/yondifon "yondifon (1 commits)")[![alexstewartja](https://avatars.githubusercontent.com/u/6935309?v=4)](https://github.com/alexstewartja "alexstewartja (1 commits)")[![Eighke](https://avatars.githubusercontent.com/u/2734125?v=4)](https://github.com/Eighke "Eighke (1 commits)")

---

Tags

ailaravelmcpmcp-climcp-clientmcp-serversrest-apirestful-apiapirestcrudlaravel-restify

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/binaryk-laravel-restify/health.svg)

```
[![Health](https://phpackages.com/badges/binaryk-laravel-restify/health.svg)](https://phpackages.com/packages/binaryk-laravel-restify)
```

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[lomkit/laravel-rest-api

A package to build quick and robust rest api for the Laravel framework.

59152.2k](/packages/lomkit-laravel-rest-api)[xtend-packages/rest-presenter

REST API Presenter &amp; Generator for Laravel

771.5k](/packages/xtend-packages-rest-presenter)[guanguans/laravel-api-response

Normalize and standardize Laravel API response data structure. - 规范化和标准化 Laravel API 响应数据结构。

485.6k](/packages/guanguans-laravel-api-response)[jarischaefer/hal-api

Enhances your HATEOAS experience by automating common tasks.

291.4k](/packages/jarischaefer-hal-api)[bjerke/laravel-bread

A boilerplate package for BREAD operations through REST API in Laravel

115.2k](/packages/bjerke-laravel-bread)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
