Skip to content

congraphcms/laravel-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

congraph/laravel-api

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
  • User model
  • 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

About

Reusable Laravel HTTP API layer for Congraph CMS, including CRUD, typed entity routes, delivery routes, and Sanctum-friendly integration.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages