A comprehensive content management package for the NetAuraTech CoreCMS system, providing a complete solution for managing pages, articles, templates, categories, and tags.
This package extends the CoreCMS functionality by providing a robust content management system with visual block-based editing, form handling, SEO optimization, and multi-content type support. It integrates seamlessly with the CoreCMS architecture to deliver a powerful content creation and management experience.
- ✅ Multi-Content Type Support: Pages, articles, templates, and more
- ✅ Visual Block Editor: Drag-and-drop interface with live preview
- ✅ Category and Tag Management: Organize content with taxonomies
- ✅ SEO Optimization: Automatic sitemap generation and robots.txt
- ✅ Form Builder: Contact forms and custom form generation
- ✅ Template System: Reusable content blocks via shortcodes
- ✅ Cache Management: Intelligent cache purging and preloading
- ✅ Multilingual Support: Built-in translation system
- ✅ Responsive Admin Interface: Modern, user-friendly administration
- ✅ CAPTCHA Integration: Spam protection for forms
- ✅ Asset Management: Automatic CSS generation and optimization
- ✅ Content Scheduling: Publish/unpublish content with dates
- PHP ^8.1
- Laravel ^12.0
- NetAuraTech CoreCMS ^1.0
- Preact ^10.27.0 (React-like library for UI components)
- Quill ^2.0.3 (Rich text editor)
- TomSelect ^2.4.3 (Advanced select component)
- SortableJS ^1.15.6 (Drag & drop functionality)
- Zustand ^5.0.3 (State management)
- Tippy.js ^6.3.7 (Tooltips)
- DOMPurify ^3.2.6 (HTML sanitization)
composer require netauratech/content-manager- Clone the repository into your Laravel project
- Add the dependency to your
composer.json - Run
composer install
The service provider is automatically registered through Laravel's package discovery. For manual registration, add to config/app.php:
'providers' => [
// ...Netauratech\ContentManager\ContentManagerServiceProvider::class,
],Publish and run the migrations:
php artisan vendor:publish --tag=core-cms-migrations
php artisan migratePublish and run the seeders:
php artisan vendor:publish --tag=core-cms-seeders
php artisan db:seed --class=ContentSeederPublish translation files to customize messages:
php artisan vendor:publish --tag=core-cms-translationsNavigate to the admin panel and access content management:
- Pages:
/admin/contents/page - Articles:
/admin/contents/article - Templates:
/admin/contents/template
Pages
- Static content with flexible layouts
- Can be set as homepage
- SEO-optimized with meta fields
Articles
- Blog-style content with categories and tags
- Publication scheduling
- Archive and draft support
Templates
- Reusable content blocks
- Can be embedded via shortcodes:
[template id=123] - Shared across multiple pages
The package includes a powerful visual editor with drag-and-drop functionality and live preview. The editor uses a block-based system where each block is defined as a JSON object:
{
"_name": "section",
"title": "Welcome Section",
"content": "<p>Your content here</p>",
"background-color": "#f8f9fa",
"padding-block": "large"
}- Section: Basic content block with title, text, and media
- Carousel: Sliding content blocks
- Gallery: Automatic image gallery with lightbox
- Contact Form: Built-in contact functionality
- Custom Forms: Dynamic form builder
- Media: Image/video display with advanced options
- Links: Navigation and link lists
- Theme Switcher: Dark/light mode toggle
You can extend the visual editor by adding custom blocks through your theme's JavaScript. The editor provides a comprehensive API for creating custom components with sophisticated field types and layouts.
Setting up Theme Extensions
Create a JavaScript file in your theme and define new components using the editor's API:
consttranslate=window.translate;consteditor=window.editor;constlayouts=editor.layouts;constfields=editor.fields;editor.initializeTheme=function(options){// Set internal page/content options for linkseditor.setOptions(options);constcomponents=[{_id: 'hero-section',label: translate('theme.blocks.hero.label'),title: translate('theme.blocks.hero.title'),category: translate('content-manager.admin.editor.category.content'),canEditAppearance: true,// Enables background, animation, appearance tabsfields: [// Title with styling optionseditor.titleField('title',translate('content-manager.admin.editor.sidebar.tabs.title.value')),// Rich text content with color palettefields.HtmlText('content',{label: translate('content-manager.admin.editor.sidebar.tabs.content'),colors: Object.values(editor.colors()),canAnimate: true}),// Media field with advanced options
...editor.mediaField('hero-image'),// Call-to-action buttonsfields.Repeater('buttons',{addLabel: translate('core-cms.admin.add'),fields: [...editor.links()],// Reuse link helperlabel: translate('content-manager.admin.editor.sidebar.tabs.ctas')})]},{_id: 'testimonials',title: translate('theme.blocks.testimonials.title'),category: translate('content-manager.admin.editor.category.content'),fields: [layouts.Row([fields.Text('title',{label: translate('content-manager.admin.editor.sidebar.tabs.title.value'),canAnimate: true}),fields.Number('columns',{label: translate('theme.fields.columns'),default: "3",min: 1,max: 4})]),fields.Repeater('testimonials',{addLabel: translate('theme.add_testimonial'),collapsed: 'author',// Use author field as collapse titlefields: [fields.Text('quote',{label: translate('theme.fields.quote'),multiline: true}),fields.Text('author',{label: translate('theme.fields.author')}),fields.Text('position',{label: translate('theme.fields.position')}),fields.Media('avatar',{label: translate('theme.fields.avatar')})],label: translate('theme.fields.testimonials')})]}];// Register all custom componentseditor.registerComponents(components);editor.defineElement();};The editor provides a comprehensive set of field types:
Basic Fields:
fields.Text(name, options)- Single line text inputfields.HtmlText(name, options)- Rich text editor with Quillfields.Number(name, options)- Numeric input with min/max/stepfields.Range(name, options)- Slider inputfields.Checkbox(name, options)- Boolean switchfields.Select(name, options)- Dropdown selectionfields.Color(name, options)- Color picker with palettefields.Media(name, options)- File/image pickerfields.DatePicker(name, options)- Date selection
Advanced Fields:
fields.Repeater(name, options)- Dynamic array of fieldslayouts.Row(fields)- Horizontal field layoutlayouts.Tabs(tabDefinitions)- Tabbed field organization
Helper Methods:
editor.titleField(name, label)- Complete title with styling optionseditor.mediaField(name)- Media with alt text and sizingeditor.animationField(key, label)- Animation controlseditor.links()- Internal/external link fieldseditor.baseTabs(fields)- Standard content/animation/background/appearance tabs
Each field type supports various options:
fields.Text('field-name',{label: 'Field Label',help: 'Help text shown below field',default: 'Default value',multiline: false,// Use textarea if truecanAnimate: true// Adds animation controls in appearance tab})fields.Select('choice',{label: 'Make a Choice',options: [{value: 'option1',label: 'Option 1'},{value: 'option2',label: 'Option 2'}],default: 'option1'})fields.Repeater('items',{label: 'Item List',addLabel: 'Add New Item',collapsed: 'title',// Field name to use as collapse titlemin: 1,// Minimum itemsmax: 10,// Maximum itemsfields: [// Nested field definitions]})Fields can be shown/hidden based on other field values:
fields.Text('subtitle',{label: 'Subtitle'}).when('show-subtitle',true),// Only show when show-subtitle is truefields.Color('text-color',{label: 'Text Color'}).when('style-type','custom'),// Only show when style-type equals 'custom'Organize custom blocks using predefined categories:
translate('content-manager.admin.editor.category.content')- Content blockstranslate('content-manager.admin.editor.category.layout')- Layout containerstranslate('content-manager.admin.editor.category.template')- Template components
After defining JavaScript components, create corresponding Blade templates in your theme:
// resources/views/theme/hero-section.blade.php
@extends('content-manager::shared.blocks.layouts.layout')
@php
$block = $block ?? [];
$section = $section ?? 'section';
$classes = ['hero-section'];
@endphp
@section('class')
{{ join('', $classes) }}
@overwrite
@section('element')
{{ $section }}
@overwrite
@section('content')
<div class="container">
@if(!empty($block['hero-image']))
<div class="hero-image">
{!! image_tag($block['hero-image'], $block['hero-image-alt'] ?? '', $block['hero-image-width'] ?? null) !!}
</div>
@endif
@if(!empty($block['title']))
@include('content-manager::shared.blocks.components.title', ['block' => $block])
@endif
@if(!empty($block['content']))
@include('content-manager::shared.blocks.components.content', ['block' => $block])
@endif
@if(!empty($block['buttons']))
<div class="hero-buttons">
@foreach($block['buttons'] as$button)
@include('content-manager::shared.blocks.components.cta', ['block' => $button])
@endforeach
</div>
@endif
</div>
@overwriteCSS Integration The package automatically generates CSS for each block based on its settings. Custom properties are available for styling:
.block__[hash] {
--background-color:/* User selected color */;
--grid-gap:/* User selected gap */;
}
.block__[hash]-title {
color:/* User selected title color */;
text-decoration:/* User selected decoration */;
}This comprehensive system allows themes to create sophisticated, user-friendly content blocks while maintaining consistency with the CMS architecture.
Organize content with hierarchical systems:
// Create categories$category = newCategory();
$category->name = 'Technology';
$category->save();
// Attach to content$content->categories()->attach($category->id);Built-in contact form with CAPTCHA protection:
Route::post('/forms/{slug}/contact', [FormSubmissionController::class, 'submit']);Create dynamic forms through the visual editor:
// Form sections with various field types'sections' => [
[
'title' => 'Personal Information',
'visible' => true,
'fields' => [
[
'label' => 'Full Name',
'type' => 'text',
'help' => 'Enter your full name'
],
[
'label' => 'Country',
'type' => 'select',
'options' => [
['option' => 'France'],
['option' => 'Germany']
]
]
]
]
]The package generates XML sitemaps automatically:
<urlsetxmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
</urlset>Dynamic robots.txt with sitemap reference:
User-agent: *
Disallow: /admin/
Disallow: /profile/
Sitemap: https://example.com/sitemap.xml
Use templates across content via shortcodes:
// In content"Welcome to our site! [template id=3] Thank you for visiting."// Renders the template content inlineThe package includes intelligent caching:
// Automatic cache purging on content updatespublicfunctionpurge(Content$content): void
{
// Clear related URLs// Precache updated content// Notify CDN if configured
}Extend functionality through content providers:
class CustomContentProvider implements ContentProviderInterface
{
publicfunctiongetArticles(int$perPage = 10): LengthAwarePaginator
{
return Content::where('type', 'article')
->where('status', 'published')
->orderBy('published_at', 'desc')
->paginate($perPage);
}
}Create custom block templates:
// resources/views/theme/custom-block.blade.php
@extends('content-manager::shared.blocks.layouts.layout')
@section('content')
<div class="custom-block">
{{ $block['custom-field'] }}
</div>
@endsectionThe package automatically registers menu items:
$menuManager->registerMenuItem('content-management', [
'label' => 'Content',
'children' => [
[
'label' => 'Pages',
'route' => 'admin.contents.index',
'params' => ['type' => 'page']
]
]
]);Automatic CSS generation for visual blocks:
.block__a1b2c3d4 {
--background-color:#f8f9fa;
--grid-gap:2rem;
}
.block__a1b2c3d4-title {
color:#333;
text-decoration-line: underline;
}src/
├── Http/
│ ├── Controllers/
│ │ ├── Admin/
│ │ │ ├── CategoryController.php
│ │ │ ├── ContentController.php
│ │ │ └── TagController.php
│ │ ├── FormSubmissionController.php
│ │ ├── PageController.php
│ │ └── SeoContentController.php
│ └── Requests/
│ └── Admin/
├── Models/
│ ├── Category.php
│ ├── Content.php
│ └── Tag.php
├── Services/
│ ├── ContentProvider.php
│ ├── ContentPurgeProvider.php
│ └── Shortcode/
├── Mail/
├── Jobs/
├── Observers/
├── resources/
│ ├── ts/ (TypeScript components)
│ └── views/ (Blade templates)
├── routes/
├── database/
└── lang/
- CSRF protection on all forms
- CAPTCHA integration for spam prevention
- Input validation and sanitization
- XSS protection through DOMPurify
- Permission-based access control
- Lazy CSS loading with preload hints
- Database query optimization
- Intelligent cache management
- Asset concatenation and minification
- Image optimization helpers
The package supports multiple languages:
// lang/en/admin.phpreturn [
'content' => [
'title' => 'Title',
'status' => [
'draft' => 'Draft',
'published' => 'Published',
'archived' => 'Archived'
]
]
];Available translation keys:
- Content management interface
- Form labels and validation messages
- Status indicators
- Navigation elements
- 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 tests
php artisan test# Frontend testing
npm testinterface ContentProviderInterface
{
publicfunctiongetArticles(int$perPage = 10): LengthAwarePaginator;
publicfunctiongetPages(int$perPage = 10): LengthAwarePaginator;
publicfunctiongetContentById(int$id): ?object;
publicfunctiongetContentBySlug(string$slug): ?object;
}// Dispatched when content is saved
ContentSaved::dispatch($content, $request);
// Listen for language loading
LangLoaded::dispatch('content-manager');Assets Not Loading
# Clear cache and rebuild
php artisan cache:clear
php artisan view:clearMigration Issues
# Check migration status
php artisan migrate:status
# Rollback if needed
php artisan migrate:rollback --step=1This package is open-source software licensed under the MIT license.
For support or questions:
- Email: contact@netauratech.fr
- Documentation: Check the CoreCMS documentation
- Issues: Create an issue on GitHub
- Initial release
- Multi-content type support
- Visual block editor
- SEO optimization
- Form handling system
- Cache management
- Translation support
NetAuraTech - Initial work - NetAuraTech
© 2025 NetAuraTech. All rights reserved.