pictastudio / contento
cms library to manage dynamic content
Fund package maintenance!
Requires
- php: ^8.4
- illuminate/contracts: ^12.0
- nevadskiy/laravel-tree: ^0.6.1
- pictastudio/translatable: ^0
- 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
- phpstan/phpstan: ^2.1
This package is auto-updated.
Last update: 2026-04-30 17:11:51 UTC
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
If you are upgrading from an earlier release, publish the latest package migrations again before running php artisan migrate. Recent upgrades add the menu_items.path, menu_items.sort_order, and faqs.sort_order columns through package migrations.
You can publish the config file with:
php artisan vendor:publish --tag="contento-config"
This is the contents of the published config file:
return [ 'authorize_using_policies' => env('CONTENTO_AUTHORIZE_USING_POLICIES', true), 'models' => [ 'page' => \PictaStudio\Contento\Models\Page::class, 'faq_category' => \PictaStudio\Contento\Models\FaqCategory::class, 'faq' => \PictaStudio\Contento\Models\Faq::class, 'mail_form' => \PictaStudio\Contento\Models\MailForm::class, 'modal' => \PictaStudio\Contento\Models\Modal::class, 'content_tag' => \PictaStudio\Contento\Models\ContentTag::class, 'setting' => \PictaStudio\Contento\Models\Setting::class, ], 'table_names' => [ 'pages' => 'pages', 'faq_categories' => 'faq_categories', 'faqs' => 'faqs', 'mail_forms' => 'mail_forms', 'modals' => 'modals', 'content_tags' => 'content_tags', 'content_taggables' => 'content_taggables', 'settings' => 'settings', ], 'routes' => [ 'api' => [ 'v1' => [ 'prefix' => 'api/contento/v1', 'name' => 'api.contento.v1', 'middleware' => ['api'], 'pagination' => [ 'per_page' => 15, 'max_per_page' => 100, ], ], 'enable' => true, 'json_resource_enable_wrapping' => true, ], ], ];
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/menus- List menusGET /api/contento/v1/menus/{id_or_slug}- Get a single menuGET /api/contento/v1/menu-items- List menu itemsGET /api/contento/v1/menu-items/{id_or_slug}- Get a single menu itemPOST /api/contento/v1/menu-items/bulk/upsert- Create and update menu items in a single requestGET /api/contento/v1/faq-categories- List FAQ categories with questionsPOST /api/contento/v1/faqs/bulk/upsert- Create and update FAQs in a single requestGET /api/contento/v1/settings- List all settings (always non-paginated)POST /api/contento/v1/settings/bulk/update- Create and update settings in a single request
All endpoints return JSON responses using Laravel API Resources.
Pages accept a nullable metadata object for structured page metadata such as SEO fields.
Common list query parameters
Most index endpoints support:
pageper_pagesort_bysort_direxclude_all_scopesexclude_active_scopeexclude_date_range_scope
Pages also support exclude_published_scope.
Menus, modals, and content tags also support all=1 or filter=all to return every matching record as a non-paginated collection while skipping their implicit active and visibility date-range scopes.
Menu query parameters
GET /api/contento/v1/menus supports:
id[]titleslugactiveoris_activevisible_date_from,visible_date_from_start,visible_date_from_endvisible_date_to,visible_date_to_start,visible_date_to_endcreated_at_start,created_at_endupdated_at_start,updated_at_endinclude=items
Menu item query parameters
GET /api/contento/v1/menu-items supports:
id[]menu_idparent_idtitlesluglinkactiveoris_activevisible_date_from,visible_date_from_start,visible_date_from_endvisible_date_to,visible_date_to_start,visible_date_to_endcreated_at_start,created_at_endupdated_at_start,updated_at_endas_tree=1include=menu,parent,children
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.