A comprehensive Laravel package providing the core foundation, services, and administration interface for content management systems.
This package provides a complete foundation for building content management systems on Laravel. It offers essential CMS functionality including user authentication, asset management, backup systems, captcha challenges, shortcode parsing, and an extensible admin interface. The package is designed to be modular and easily extendable.
- ✅ Complete authentication system with Laravel Breeze integration
- ✅ Dynamic asset management with Vite integration
- ✅ Comprehensive backup system with automatic cleanup
- ✅ Puzzle-based CAPTCHA security system
- ✅ Flexible options management with database caching
- ✅ Admin dashboard with customizable widgets
- ✅ Shortcode system for dynamic content
- ✅ Multi-language support with translation management
- ✅ Social authentication (OAuth integration)
- ✅ Permission-based access control with Spatie Permission
- ✅ Cache management with LiteSpeed support
- ✅ Content management (pages, templates, articles)
- ✅ Taxonomies (categories, tags)
- ✅ Media management integration
- ✅ Form handling with CAPTCHA protection
- ✅ SEO features (sitemap.xml, robots.txt)
- PHP ^8.1
- Laravel ^12.0
composer require netauratech/core-cms- Clone the repository into your Laravel project
- Add the dependency to your
composer.json - Run
composer install
The service provider is automatically registered thanks to Laravel's automatic discovery. If you want to register it manually, add it to config/app.php:
'providers' => [
// ...Netauratech\CoreCms\CoreCmsServiceProvider::class,
],Publish the configuration files to customize the package:
php artisan vendor:publish --tag=core-cms-configThis will publish:
config/core-cms.php- Main CMS configurationconfig/auth.php- Authentication configurationconfig/backup.php- Backup system configurationconfig/lscache.php- LiteSpeed cache configurationconfig/permission.php- Permission system configuration
Main CMS configuration:
return [
'admin' => [
'middleware' => [
'auth',
'web',
'lscache:no-cache',
ThemeMiddlewareInterface::class,
BackupSessionForEsi::class,
SmartCacheControlMiddleware::class
],
'prefix' => 'admin', // Admin URL prefix'name' => 'admin.', // Route name prefix
],
'media' => [
'model' => null// Custom media model (optional)
]
];Authentication configuration with remember me duration:
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
'remember' => 10080// Remember me duration in minutes (7 days)
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', Netauratech\CoreCms\Models\User::class),
],
],Backup system configuration (powered by Spatie Backup):
return [
'backup' => [
'name' => env('BACKUP_LOCATION_FOLDER', 'backup'),
'source' => [
'files' => [
'include' => [base_path()],
'exclude' => [
base_path('vendor'),
base_path('node_modules'),
],
],
'databases' => [env('DB_CONNECTION', 'mysql')],
],
'destination' => [
'filename_prefix' => '',
'disks' => ['local'],
],
],
'cleanup' => [
'default_strategy' => [
'keep_all_backups_for_days' => 7,
'keep_daily_backups_for_days' => 16,
'keep_weekly_backups_for_weeks' => 8,
'keep_monthly_backups_for_months' => 4,
'keep_yearly_backups_for_years' => 2,
],
],
];LiteSpeed Cache configuration:
return [
'esi' => env('LSCACHE_ESI_ENABLED', false),
'default_ttl' => env('LSCACHE_DEFAULT_TTL', 0),
'default_cacheability' => env('LSCACHE_DEFAULT_CACHEABILITY', 'no-cache'),
'guest_only' => env('LSCACHE_GUEST_ONLY', false),
];Spatie Permission configuration:
return [
'models' => [
'permission' => Spatie\Permission\Models\Permission::class,
'role' => Spatie\Permission\Models\Role::class,
],
'table_names' => [
'roles' => 'roles',
'permissions' => 'permissions',
'model_has_permissions' => 'model_has_permissions',
'model_has_roles' => 'model_has_roles',
'role_has_permissions' => 'role_has_permissions',
],
'cache' => [
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
'key' => 'spatie.permission.cache',
'store' => 'default',
],
];Add these variables to your .env file:
# AuthenticationAUTH_GUARD=webAUTH_MODEL=Netauratech\CoreCms\Models\User# BackupBACKUP_LOCATION_FOLDER=backupBACKUP_ARCHIVE_PASSWORD=null# LiteSpeed CacheLSCACHE_ESI_ENABLED=falseLSCACHE_DEFAULT_TTL=0LSCACHE_DEFAULT_CACHEABILITY=no-cacheLSCACHE_GUEST_ONLY=falsePublish the package assets:
php artisan vendor:publish --tag=core-cms-assetsRun the migrations to create the necessary database tables:
php artisan migrateRun the installation command to set up the CMS:
php artisan cms:installThis command will:
- Run all package migrations
- Execute database seeders (creates admin user, roles, permissions, default content)
- Publish package assets
Default Admin Credentials:
- Email:
admin@example.com - Password:
password
The package provides a comprehensive asset management system:
In your service provider:
useNetauratech\CoreCms\Services\AssetManager;
publicfunctionboot(AssetManager$assetManager)
{
// Register JavaScript assets$assetManager->registerAppJs('path/to/app.js');
$assetManager->registerAdminJs('path/to/admin.js');
// Register CSS assets$assetManager->registerCss('path/to/styles.css');
// Register translations$assetManager->registerTranslationPath('my-package', __DIR__.'/lang');
}Generate dynamic asset entry points:
php artisan assets:discoverAdd widgets to the admin dashboard:
useNetauratech\CoreCms\Services\Admin\DashboardManager;
publicfunctionboot(DashboardManager$dashboardManager)
{
$dashboardManager->addWidget(MyCustomWidget::class);
}Register menu items in the admin interface:
useNetauratech\CoreCms\Services\Admin\MenuManager;
publicfunctionboot(MenuManager$menuManager)
{
$menuManager->registerMenuItem('my-item', [
'label' => 'My Menu Item',
'icon' => 'icon-name',
'route' => 'admin.my-route',
'can' => 'permission-name'
]);
}Create and register custom shortcodes:
useNetauratech\CoreCms\Services\Shortcode\ShortcodeRegistry;
publicfunctionboot(ShortcodeRegistry$shortcodeRegistry)
{
$shortcodeRegistry->register('my-shortcode', function($attrs, $context) {
$url = $attrs['url'] ?? '#';
$text = $attrs['text'] ?? 'Default text';
return"<a href=\"{$url}\">{$text}</a>";
});
}In Blade templates:
@shortcode('[button url="/contact" text="Contact Us"]')
@shortcode('[my-shortcode url="/about" text="Learn More"]')The package includes several built-in shortcodes:
[button url="/path" type="primary" text="Click me"]- Creates styled buttons[option key="site_name"]- Retrieves option values[template id=3]- Includes template content
useNetauratech\CoreCms\Contracts\BackupProviderInterface;
$backupProvider = app(BackupProviderInterface::class);
$backupProvider->run(['--only-db' => true], ['--disable-notifications' => true]);# Full backup
php artisan core-cms:backup
# Database only backup
php artisan core-cms:backup --only-db
# Disable notifications
php artisan core-cms:backup --disable-notifications// Generate a challenge key$challengeKey = generate_challenge();<puzzle-captchaname="{{ $name }}"
width="350"
height="200"
piece-width="80"
piece-height="50"
src="{{ route('captcha.image', ['key' => $challengeKey]) }}"
><inputtype="hidden" name="captcha-challenge" id="captcha-challenge" value="{{ $challengeKey }}"><inputtype="hidden" name="captcha-answer" id="captcha-answer"></puzzle-captcha>useNetauratech\CoreCms\Contracts\ChallengeInterface;
$challenge = app(ChallengeInterface::class);
$isValid = $challenge->verify($request->challenge, $request->answer);
if ($isValid) {
// Process form submission
} else {
// Handle invalid captcha
}The package provides a flexible content management system:
useNetauratech\CoreCms\Contracts\ContentProviderInterface;
$contentProvider = app(ContentProviderInterface::class);
// Get published content$pages = $contentProvider->getContents('page', 10);
$articles = $contentProvider->getContents('article', 20);
// Get content by slug$page = $contentProvider->getContentBySlug('about-us');
// Get content by category$categoryArticles = $contentProvider->getContentsByCategory('article', 'news', 10);Register custom form fields dynamically:
useNetauratech\CoreCms\Form\FormRegistry;
publicfunctionboot(FormRegistry$formRegistry)
{
$formRegistry->registerFormFields('content_form', [
'custom_field' => [
'type' => 'text',
'label' => 'Custom Field',
],
]);
$formRegistry->registerValidationRules('content_form', [
'custom_field' => ['required', 'string', 'max:255'],
]);
}The package provides several utility functions:
// Generate SVG iconsechoicon('home');
// Check active menu stateechomenu_active(route('admin.dashboard'));
// Image handlingechoimage_url($mediaId, 300, 200);
echoimage_tag($mediaId, 'Alt text', 200);
// Generate CAPTCHA challenge$key = generate_challenge();
// Time formattingechoago($carbonDate, 'Created');
// Exception handlingechoshortened_exception($exceptionMessage);To customize the translation messages:
php artisan vendor:publish --tag=core-cms-translationsThis will copy translation files to lang/vendor/core-cms/ in your Laravel application.
admin.php- Admin interface translationsauth.php- Authentication messagescore.php- Core system messagesmail.php- Email notifications
- English (en)
- French (fr)
Implement the ContentProviderInterface:
useNetauratech\CoreCms\Contracts\ContentProviderInterface;
class MyContentProvider implements ContentProviderInterface
{
publicfunctiongetContents(string$type, ?int$perPage): LengthAwarePaginator
{
// Return paginated content
}
publicfunctiongetContentBySlug(string$slug): ?object
{
// Return content by slug
}
// ... implement other required methods
}Register in your service provider:
$this->app->bind(ContentProviderInterface::class, MyContentProvider::class);Implement media management:
useNetauratech\CoreCms\Contracts\MediaProviderInterface;
class MyMediaProvider implements MediaProviderInterface
{
publicfunctiongetImageUrl(string|int$id, ?int$width = null, ?int$height = null): string
{
// Generate image URL with optional resizing
}
// ... implement other methods
}Register the provider:
$this->app->bind(MediaProviderInterface::class, MyMediaProvider::class);Create custom asset resolution:
useNetauratech\CoreCms\Contracts\AssetSourceInterface;
class MyAssetSource implements AssetSourceInterface
{
publicfunctionresolve(string$path, ?string$theme): BinaryFileResponse|Response|null
{
// Custom asset resolution logicreturnresponse()->file($resolvedPath);
}
}Tag your asset source:
$this->app->tag(MyAssetSource::class, 'cms.asset.sources');Implement custom cache purge logic:
useNetauratech\CoreCms\Contracts\PurgeUrlProviderInterface;
useIlluminate\Database\Eloquent\Model;
class MyPurgeProvider implements PurgeUrlProviderInterface
{
publicfunctiongetUrlsToPurge(Model$content): array
{
// Return URLs to purge when content is updatedreturn ["/my-page/{$content->slug}"];
}
publicfunctiongetAllManagedUrls(): array
{
// Return all URLs managed by this providerreturn ['/my-page/1', '/my-page/2'];
}
}Tag the provider:
$this->app->tag(MyPurgeProvider::class, 'content_purge_providers');src/
├── Console/ # Artisan commands
│ ├── BackupCmsCommand.php
│ ├── BackupCommand.php
│ ├── CleanupCommand.php
│ ├── DiscoverAssetsCommand.php
│ └── InstallCommand.php
├── Contracts/ # Service interfaces
│ ├── AssetSourceInterface.php
│ ├── BackupProviderInterface.php
│ ├── CacheServiceInterface.php
│ ├── ChallengeGeneratorInterface.php
│ ├── ChallengeInterface.php
│ ├── CommentableInterface.php
│ ├── ContentProviderInterface.php
│ ├── MediaProviderInterface.php
│ ├── PurgeUrlProviderInterface.php
│ └── ThemeMiddlewareInterface.php
├── Events/ # Event classes
│ ├── CacheCleared.php
│ ├── ContentSaved.php
│ └── OptionUpdated.php
├── Form/ # Form management
│ └── FormRegistry.php
├── Helpers/ # Helper functions
│ └── helpers.php
├── Http/
│ ├── Controllers/ # Package controllers
│ │ ├── Admin/ # Admin controllers
│ │ ├── Api/ # API controllers
│ │ └── Auth/ # Authentication controllers
│ ├── Middlewares/ # HTTP middlewares
│ └── Requests/ # Form requests
├── Jobs/ # Queue jobs
│ └── PrecacheContent.php
├── Listeners/ # Event listeners
│ └── ClearOptionCache.php
├── Mail/ # Mailable classes
│ └── GenericFormMail.php
├── Models/ # Eloquent models
│ ├── Category.php
│ ├── Content.php
│ ├── FailedJob.php
│ ├── Option.php
│ ├── Tag.php
│ └── User.php
├── Notifications/ # Notification classes
├── Observers/ # Model observers
│ └── ContentObserver.php
├── Services/ # Core services
│ ├── Admin/
│ │ ├── DashboardManager.php
│ │ └── MenuManager.php
│ ├── Captcha/
│ │ ├── PuzzleChallenge.php
│ │ └── PuzzleGenerator.php
│ ├── Shortcode/
│ │ ├── ButtonShortcode.php
│ │ ├── OptionShortcode.php
│ │ ├── ShortcodeParser.php
│ │ ├── ShortcodeRegistry.php
│ │ └── TemplateShortcode.php
│ ├── AbstractCmsServiceProvider.php
│ ├── AssetManager.php
│ ├── BackupProvider.php
│ ├── CacheService.php
│ ├── ContentProvider.php
│ ├── ContentPurgeProvider.php
│ ├── NullContentProvider.php
│ ├── NullMediaProvider.php
│ └── StorageAssetSource.php
├── Widgets/ # Dashboard widgets
│ └── TasksWidget.php
├── resources/
│ ├── views/ # Blade views
│ └── assets/ # Static assets (images, icons)
├── lang/ # Translation files
│ ├── en/
│ └── fr/
├── database/
│ ├── migrations/ # Database migrations
│ ├── seeders/ # Database seeders
│ └── factories/ # Model factories
├── routes/ # Package routes
│ ├── admin.php # Admin routes
│ ├── api.php # API routes
│ ├── auth.php # Authentication routes
│ └── web.php # Public routes
└── CoreCmsServiceProvider.php # Main service provider
GET /api/captcha/generate # Generate new challenge
GET /captcha/{key} # Get challenge image
POST /api/captcha/check # Verify response
GET /api/csrf # Get CSRF token
GET /api/flash-messages # Get flash messages
GET /api/{type}/search # Search taxonomies (auth required)
GET /assets/{path} # Serve assets with caching
GET /js/translations.js # Frontend translations
Access the admin interface at /admin (configurable prefix).
cms:install- Complete CMS installation
assets:discover- Discover and generate asset entry points
core-cms:backup- Run backup with optionscore-cms:backup-run- Execute backup processcore-cms:backup-clean- Clean old backups
The package dispatches several events you can listen to:
CacheCleared- When cache is clearedContentSaved- When content is savedOptionUpdated- When system options are updated
BackupSessionForEsi- Backup flash messages for ESI compatibilitySmartCacheControlMiddleware- Intelligent cache control based on page contentThemeMiddlewareInterface- Theme resolution middleware (can be implemented)
Contributions are welcome! Please:
- Fork the project
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Run the package tests:
composer testThis package is open-source software licensed under the MIT license.
For support or questions:
- Email: contact@netauratech.fr
- Create an issue on GitHub
- Initial release
- Complete authentication system with social login
- Asset management with Vite integration
- Backup functionality with Spatie Backup
- Admin interface with dashboard and widgets
- Shortcode system with built-in shortcodes
- CAPTCHA integration with puzzle challenge
- Content management (pages, templates, articles)
- Taxonomy system (categories, tags)
- Permission system with Spatie Permission
- Form registry for dynamic form fields
- LiteSpeed cache support
- SEO features (sitemap, robots.txt)
- Multi-language support (EN, FR)
- NetAuraTech - Initial work - NetAuraTech
© 2025 NetAuraTech. All rights reserved.