sinevia / laravel-cms
Content Management System for Laravel
Installs: 1 284
Dependents: 0
Suggesters: 0
Security: 0
Stars: 21
Watchers: 5
Forks: 8
Open Issues: 3
Language:Blade
Requires
- php: ~5.6|~7.0|~8.0
- illuminate/support: 5.*|6.*|7.*|8.*|9.*|10.*
Requires (Dev)
- phpunit/phpunit: >=5.4.3
- squizlabs/php_codesniffer: ^2.3
- dev-master
- v2.37.0
- v2.36
- v2.35
- v2.34
- v2.33
- v2.31
- v2.24
- v2.23
- v2.22
- v2.21
- v2.20
- v2.19
- v2.18.8
- v2.18.6
- v2.18.4
- v2.18.2
- v2.18
- v2.17
- v2.16.2
- v2.16.0
- v2.15.0
- v2.13.0
- v2.12.0
- v2.11.0
- v2.10.0
- v2.9.0
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.7
- v2.2.0
- v2.1.0
- v2.0.0
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.14
- v1.1.13
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.6
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
This package is auto-updated.
Last update: 2024-10-14 08:24:48 UTC
README
A "plug-and-play" content managing system (CMS) for Laravel that does its job and stays out of your way.
Introduction
All of the existing Laravel CMS (OctoberCms, AsgardCms, PyroCms, etc) require a full installations from scratch. Its impossible to just add them to an exiting Laravel application, and even when added feel like you don't get what you hoped for.
This package allows to add a content management system as a package dependency in your composer file, which can be easily updated or removed as required to ANY Laravel app. It is fully self contained, and does not require any additional packages or dependencies. Removal is also a breeze just remove from your composer file.
Features
- Templates (aka master layouts)
- Pages (web pages)
- Blocks (reusable cutom pieces of code -- headers, footers)
- Widgets (dynamic reusable pre-defined components)
Installation (est. 5-10 mins)
- Install required library
composer require lesichkovm/laravel-advanced-route composer require lesichkovm/laravel-advanced-model
- Install the CMS
composer require sinevia/laravel-cms php artisan migrate php artisan vendor:publish --tag=config // If you want the migrations, usually not needed php artisan vendor:publish --tag=migrations // If you want the views, usually not needed php artisan vendor:publish --tag=views
Word of warning. Do use a stable package, as "dev-master" is a work in progress.
Uninstall (est. 5 mins)##
Removal of the package is a breeze:
composer remove sinevia/laravel-cms
Optionally, delete the CMS tables (all which start with the snv_cms_ prefix)
Configuration
After running the vendor:publish command, the CMS settings will be published in the /config/cms.php config file. Check these out, and modify according to your taste
Route Settings
- CMS Endpoint (public, catch all)
\Route::group(['prefix' => '/'], function () { // will match only one level deep (not recommended) \Route::any('/{path?}', '\Sinevia\Cms\Http\Controllers\CmsController@anyPageView'); // or use with regex expression to match any level \Route::any('/{path?}', '\Sinevia\Cms\Http\Controllers\CmsController@anyPageView') ->where('path', '([a-zA-z0-9\/\-]++)'); // or use with simpler regex expression to match any level \Route::any('/{path?}', '\Sinevia\Cms\Http\Controllers\CmsController@anyPageView') ->where('path', '.+'); // or if you prefer using the class path (recommended) \Route::any('/{path?}', [\Sinevia\Cms\Http\Controllers\CmsController::class, 'anyPageView']) ->where('path', '.+'); });
- Admin endpoint (private, protect with middleware)
\Route::group(['prefix' => '/admin'], function () { \Route::group(['middleware'=>'adminonly'], function(){ \AdvancedRoute::controller('/cms', '\Sinevia\Cms\Http\Controllers\CmsController'); // or if your prefer using class path (recommended) \AdvancedRoute::controller('/cms', \Sinevia\Cms\Http\Controllers\CmsController::class); }); });
Templates
The templates are layouts, that can be used to display the pages in a uniform fashion. You may have multiple templates which is useful if you want to have different "look and feel" for different sections of your website.
Pages
The pages are the content which displays when you visit a specified URL. Each page may have an optional parent template, which can specify common elements (i.e. style sheets, scripts, etc) for all pages sharing the template.
Blocks
The blocks are small content snippets which can be embedded into pages and templates. Useful if you want to use on multiple pages, or to make pages more lightweight.
To embed in page or template use a shortcode like this: [[BLOCK_20180509052702261348]]
Widgets
The widgets are predefined dynamic modules which can be embedded into pages and templates (i.e. Google Maps, Contact Forms, etc). Depending on the action they perform, these may or may not have optional or requred parameters. Each widget files reside in its own directory.
To embed in page or template use a shortcode like this: [[WIDGET_20180509052702261348]]
More info: https://github.com/Sinevia/laravel-cms/wiki/Widgets
Human Friendly Aliases
The following shortcuts can be used to create human friendly page aliases, that can be used for pages with dynamic content
Example page alias: /article/:num/:string
To retrieve back you may use the following snippet
preg_match('#^/article/([0-9]+)/([a-zA-Z]+)/([a-zA-Z]+)$#', '/' . $uri, $matched); $articleId = $matched[1] ?? "";
Quick Snippets
- Advanced usage. Use the CMS templates to wrap around custom code with blade templates:
// A small helper function to place HTML in the CMS template function viewInTemplate($pageTitle, $pageContent) { $template = \Sinevia\Cms\Models\Template::find('20180126000128528925'); return $template->render('en', [ 'page_title' => $pageTitle, 'page_content' => $pageContent, ]); } // Then you may use from your controller, for instance to show a login form in $html = view('guest/auth/login', get_defined_vars())->render(); return viewInTemplate('Login', $pageContent)
Screenshots
1. Page Manager
2. Create New Page
3. Edit Page. Content View
4. Edit Page. SEO View
5. Speed Test (before additional speed improvements)
Changelog
2021.07.05 - Added support for Bootstrap 5
Alternatives
- LavaLite - requires full project from scratch, cannot be embedded in existing project as package
- OctoberCms - requires full project from scratch, cannot be embedded in existing project as package
- TypiCms - requires full project from scratch, cannot be embedded in existing project as package
- PyroCMS - requires full project from scratch, cannot be embedded in existing project as package
- Laravel8SimpleCms - requires full project from scratch, cannot be embedded in existing project as package
- Winter - requires full project from scratch, cannot be embedded in existing project as package
- GraphiteInc CMS - Archived
- Twil