congraph/laravel-api
最新稳定版本:v2.0.3
Composer 安装命令:
composer require congraph/laravel-api
包简介
Laravel HTTP API integration layer for Congraph CMS.
README 文档
README
congraph/laravel-api is the reusable Laravel HTTP API layer for Congraph.
Responsibilities
- register reusable Congraph CRUD routes
- provide typed entity routes like
/{type} - provide delivery routes, including typed delivery routes
- map Congraph command exceptions to Laravel HTTP/validation exceptions
- produce consistent linked API responses
This package is intended to replace copied app-local Congraph controllers in host Laravel apps.
Installation
composer require congraph/laravel-api
Laravel package discovery should register:
Configuration
Create config/congraph-api.php in the host app:
<?php return [ 'enabled' => true, 'route_prefix' => 'congraph/api/v1', 'route_name_prefix' => 'CB.', 'middleware' => ['api', 'auth:sanctum'], 'delivery_middleware' => ['api'], 'include_metadata' => true, 'nested_include' => true, ];
What this package covers
- attributes
- attribute sets
- entity types
- entities
- files
- locales
- workflows
- workflow points
- delivery routes
Typed routes
This package supports:
- static routes like
/congraph/api/v1/entities - typed content routes like
/congraph/api/v1/articles - generic delivery routes like
/congraph/api/v1/delivery/entities - typed delivery routes like
/congraph/api/v1/delivery/articles
The typed routes are powered by:
What should stay in the host app
Keep these outside the package:
- Sanctum setup
Usermodel- login/logout/token endpoints
- policies and permission middleware
- project-specific controllers
Development
Install dependencies
cd /Users/nikolap/git/np/congraph/packages/laravel-api
composer update -W
Run tests
composer test
Current package tests cover route and middleware behavior for typed and delivery routes.
Contribution notes
- keep this package focused on reusable HTTP concerns
- avoid coupling it to app-specific auth models or business endpoints
- add package-level HTTP tests for route behavior when extending the public API
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-11