congraph/laravel-api is the reusable Laravel HTTP API layer for Congraph.
- 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.
composer require congraph/laravel-apiLaravel package discovery should register:
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,
];- attributes
- attribute sets
- entity types
- entities
- files
- locales
- workflows
- workflow points
- delivery 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:
Keep these outside the package:
- Sanctum setup
Usermodel- login/logout/token endpoints
- policies and permission middleware
- project-specific controllers
cd /Users/nikolap/git/np/congraph/packages/laravel-api
composer update -Wcomposer testCurrent package tests cover route and middleware behavior for typed and delivery routes.
- 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