ercos/ercos-cms

CMS based on Laravel and FilamentPHP.

1.3.2 2024-04-19 08:44 UTC

This package is auto-updated.

Last update: 2024-04-19 08:45:39 UTC


README

Latest Version on Packagist Total Downloads

The Filament Headless CMS package provides a simple and easy to use CMS for Laravel applications.

Features

  • Pages : including SEO fields, page blocks, page preview and drafts
  • Menus : allows to create and manage menus and sub-menus (with pages, external links, ...) and footer content
  • Tiny MCE editor
  • Font Awesome Service (Icon Picker)

As this is intended to be headless, we do not provide any frontend views. You can use the provided data to build your own frontend using the API or Laravel functions.

Core

Installation

Install the package via composer :

composer require ercos/ercos-cms

Run the plugin install command.

php artisan ercos-cms:install

Publish the assets

php artisan filament:assets

Finally, start adding page sections using the command ercos-cms:make:section {sectionName}.

Usage

Add the plugin to your Filament installation.

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ...
            ->plugins([
                \Ercos\ErcosCms\Filament\Plugin\CmsPlugin::make()
                    ->navigationGroup('Structure')
            ]);

API routes

  • GET /api/pages : list of pages and their content
  • GET /api/pages/preview : preview of a page
  • GET /api/pages/published-urls : list of published page urls (useful for SSG)
  • GET /api/pages/{slug} : get a page by its slug
  • GET /api/sitemap : get the sitemap
  • GET /api/menus : list of menus and their content

## Useful functions when working with Laravel

  • Ercos\ErcosCms\Facades\ErcosCms::getPages() : get all pages
  • Ercos\ErcosCms\Facades\ErcosCms::getMenus() : get all menus

TinyMCE

Installation

Add your TinyMCE script in the config file

    'tiny_mce' => [
        'script' => 'https://cdn.tiny.cloud/1/********/tinymce/7/tinymce.min.js',
        ...
    ]
    'tiny-mce' => 'https://cdn.tiny.cloud/1/********/tinymce/7/tinymce.min.js'

Usage

TinyMceEditor::make('...')
    ->label('...')
    ...

FontAwesome

Installation

Add your Fontawesome css file in the config

    'fontawesome' => 'https://kit.fontawesome.com/********.css'

Usage

You may use fontawesome in a Select to choose an icon.

Select::make('...')
    ->label('...')
    ->reactive()
    ->searchable()
    ->allowHtml()
    ->getSearchResultsUsing(
        fn(string $search) => App::make(FontawesomeService::class)
            ->searchFontawesomeIconNamesOptions($search)
            ->pluck('label', 'value')
    )
    ->getOptionLabelUsing(
        fn($value) => $value
            ? App::make(FontawesomeService::class)->getHtmlElement($value)
            : null
    )
    ->preload(false)
    ...

In case you use TinyMCE, fontawesome will also be available. alt text

Testing

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.