pictastudio / contento
cms library to manage dynamic content
Fund package maintenance!
Requires
- php: ^8.4
- illuminate/contracts: ^12.0
- pictastudio/translatable: ^0.1
- spatie/laravel-package-tools: ^1.16
- spatie/laravel-sluggable: ^3.7
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
README
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
Installation
You can install the package via composer:
composer require pictastudio/contento
You can publish and run the migrations with:
php artisan vendor:publish --tag="contento-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="contento-config"
This is the contents of the published config file:
return [
'prefix' => 'api/contento/v1',
'middleware' => ['api'],
'authorize_using_policies' => env('CONTENTO_AUTHORIZE_USING_POLICIES', true),
'table_names' => [
'pages' => 'pages',
'faq_categories' => 'faq_categories',
'faqs' => 'faqs',
'mail_forms' => 'mail_forms',
'modals' => 'modals',
'settings' => 'settings',
],
];
Usage
This package provides a headless CMS API. Once installed and migrated, you can access the following endpoints:
GET /api/contento/v1/pages- List all pagesGET /api/contento/v1/pages/{id_or_slug}- Get a single pageGET /api/contento/v1/faq-categories- List FAQ categories with questionsGET /api/contento/v1/settings- List all settings
All endpoints return JSON responses using Laravel API Resources.
Authorization
Policy authorization is optional and follows host app policy registration.
Register policies in your app and keep contento.authorize_using_policies enabled:
use App\Models\Page;
use App\Policies\PagePolicy;
use Illuminate\Support\Facades\Gate;
public function boot(): void
{
Gate::policy(Page::class, PagePolicy::class);
}
Controllers check authorization only when:
contento.authorize_using_policiesistrue- there is an authenticated user
- a matching gate/policy definition exists
Testing
The package uses Pest for testing. You can run the tests using:
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.