congraph / laravel-api
Laravel HTTP API integration layer for Congraph CMS.
v2.0.3
2026-04-12 09:41 UTC
Requires
- php: ^8.3 || ^8.4 || ^8.5
- congraph/contracts: ^2.0 || dev-main || dev-master
- congraph/core: ^2.0 || dev-main || dev-master
- congraph/eav: ^2.0 || dev-main || dev-master
- congraph/entity-elastic: ^2.0 || dev-main || dev-master
- congraph/filesystem: ^2.0 || dev-main || dev-master
- congraph/locales: ^2.0 || dev-main || dev-master
- congraph/workflows: ^2.0 || dev-main || dev-master
- laravel/framework: ^13.0
Requires (Dev)
- orchestra/testbench: 11.x-dev
- phpunit/phpunit: ^12.1
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