ikoncept / fabriq
A CMS Framework by Ikoncept
Requires
- php: ^8.0
- aws/aws-sdk-php: ^3.219
- doctrine/dbal: ^3.1|^4.0
- dyrynda/laravel-make-user: ^7.3|^8.0|^9.0
- illuminate/database: ^8.56|^9.0|^10|^11
- illuminate/support: ^7.0.5|^8.0|^9.0|^10|^11
- infab/core: ^2.1
- infab/translatable-revisions: ^1.7.0
- kalnoy/nestedset: ^6.0
- laravel/fortify: ^1.8
- laravel/pint: ^1.2
- php-ffmpeg/php-ffmpeg: ^1.0
- pusher/pusher-php-server: ^7.0
- spatie/laravel-medialibrary: ^8.2|^9.0|^10.0|^11.0
- spatie/laravel-permission: ^6.0
- spatie/laravel-query-builder: ^3.5|^4.0|^5.0|^6.0
- spatie/laravel-sluggable: ^2.6|^3.0
- spatie/laravel-tags: ^3.1|^4.0
- spatie/laravel-webhook-server: ^3.8
- spatie/once: ^2.0|^3.0
- spatie/pdf-to-image: ^2.1
Requires (Dev)
- nunomaduro/collision: ^5.1|^6.0|^8.0
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^10.0
- dev-main
- 2.8.0
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.0
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.x-dev
- 1.19.1
- 1.19.0
- 1.18.0
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.1
- 1.15.0
- 1.14.1
- 1.14.0
- 1.13.1
- 1.13.0
- 1.12.0
- 1.11.4
- 1.11.3
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.11
- 1.4.10
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.1
- dev-indexable-keys
- dev-block-model
- dev-vite
- dev-feature-ask-to-leave
- dev-feature-broadcasting-v2
- dev-image-handling
- dev-feature-broadcasting
- dev-tailwind3
- dev-php8.1
- dev-develop
This package is auto-updated.
Last update: 2024-11-17 13:22:32 UTC
README
Fabriq CMS
Installation instructions 💻
Add the customer repository url for the make-user-command in your composer.json
file:
...
"repositories": {
"0": {
"type": "vcs",
"url": "https://github.com/KarabinSE/laravel-make-user"
}
},
Install Fabriq:
composer require ikoncept/fabriq "^2.0" -W
If you're planning on using AWS s3:
# Laravel > 9 composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0" # Laravel 9+ composer require league/flysystem-aws-s3-v3 "^3.0"
Install the Mailgun driver
composer require symfony/mailgun-mailer symfony/http-client
Install Laravel Sanctum as well for authentication
composer require laravel/sanctum
Add the domain to the .env
file:
SANCTUM_STATEFUL_DOMAINS=your-domain.test
SESSION_DOMAIN=your-domain.test
Publish the configurations:
php artisan vendor:publish --provider="Ikoncept\Fabriq\FabriqCoreServiceProvider" --tag=config
php artisan vendor:publish --provider="Infab\TranslatableRevisions\TranslatableRevisionsServiceProvider" --tag=config
Setup your database using the .env
Modify the user model 🧘
The user model need to extend the Fabriq\Models\User::class
// app/Models/User.php //... use Ikoncept\Fabriq\Models\User as FabriqUser; //... class User extends FabriqUser // ...
Run the fabriq:install
command:
php artisan fabriq:install
This command will publish front end assets and views. It will also run the migrations
Important Delete the files app.js
and bootstrap.js
in the resources/js
directory
rm resources/js/app.js && rm resources/js/bootstrap.js
Run pnpm install
and pnpm production
to build assets
pnpm install && pnpm production
Auth configuration 🗝
Laravel v11 and above
Note
On Laravel 11 and up the step below is not necessary since the files are overwritten when installing
Laravel below v11
Enable the Laravel Sanctum middleware in app\Http\Kernel.php
// app\Http\Kernel.php /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, // <--- 'throttle:api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ];
Register routes 🛣
Note
On Laravel 11 and up the this is not necessary since the files are overwritten when installing
Register the routes that makes sense for your app. See below examples
// routes/api.php use Ikoncept\Fabriq\Fabriq; Fabriq::routes(function ($router) { $router->forDevProtected(); }, [ 'middleware' => ['auth:sanctum', 'role:dev', 'verified'], 'prefix' => 'dev' ]); Fabriq::routes(function ($router) { $router->forApiAdminProtected(); }, [ 'middleware' => ['auth:sanctum', 'role:admin', 'verified'], 'prefix' => 'admin' ]); Fabriq::routes(function ($router) { $router->forApiProtected(); }, [ 'middleware' => ['auth:sanctum'] ]); Fabriq::routes(function ($router) { $router->forPublicApi(); });
// routes/web.php use Ikoncept\Fabriq\Fabriq; Fabriq::routes( function ($router) { $router->allWeb(); } );
Create your first user in the database, or by using a package like michaeldyrynda/laravel-make-user
Publishing assets 🗄️
Assets can be published using their respective tags. The tags that are available are:
config
- The config filefabriq-translations
- Translations for auth views and validation messagesfabriq-frontend-assets
- Front end build system and Vue project filesfabriq-views
- Blade views and layouts
You can publish these assets using the command below:
php artisan vendor:publish --provider="Ikoncept\Fabriq\FabriqCoreServiceProvider" --tag=the-tag
If you want to overwrite your old published assets with new ones (for example when the package has updated views) you can use the --force
flag
php artisan vendor:publish --provider="Ikoncept\Fabriq\FabriqCoreServiceProvider" --tag=fabriq-views --force
Note Above tags have been published when the fabriq:install
was run
Broadcasting 📢
Fabriq leverages laravel/echo as a front end dependency to communicate with a pusher server. This package is preconfigured to use Ikoncept's own websocket server, but a pusher implementation can be swapped in.
To enable semi automatic prescense broadcasting go to the /resources/js/plugins/index.js
and un-comment the the line for Laravel Echo:
// import '~/plugins/laravel-echo' import '~/plugins/toast' import '~/plugins/v-calendar' import '~/plugins/v-mask' // ...
If the Laravel Echo plugin isn't imported it will not be enabled.
Don't forget to add the proper .env
variables:
BROADCAST_DRIVER=ikoncept_pusher
PUSHER_APP_ID=400
PUSHER_APP_KEY=your-key
PUSHER_APP_SECRET=your-secret
PUSHER_APP_CLUSTER=mt1
If you want to have a presence channel for a specific page, simply add it to the route:
{ path: '/articles/:id/edit', name: 'articles.edit', component: ArticlesEdit, meta: { middleware: [RolesMiddleware, PresenceMiddleware], // <- Added here (PresenceMiddleware) roles: ['admin'], } },
If you want to have a broadcast channel for a specific page, simply add it to the route:
{ path: '/articles/:id/edit', name: 'articles.edit', component: ArticlesEdit, meta: { middleware: [RolesMiddleware, BroadcastMiddleware], // <- Added here (PresenceMiddleware) roles: ['admin'], broadcastName: 'article' } },
When the broadcast middleware is applied it will listen to updated
, created
and deleted
events. Which is useful for index views when live updates are needed.
Updating ♻️
You can publish new front end assets with the php artisan fabriq:update
command. This command will publish new front end assets and run migrations.
Done? 🎉
That should be it, serve the app and login at /login
License
The MIT License (MIT). Please see License File for more information.
Testing
composer test