Download the PHP package antonioprimera/laravel-site without Composer
On this page you can find all versions of the php package antonioprimera/laravel-site. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download antonioprimera/laravel-site
More information about antonioprimera/laravel-site
Files in antonioprimera/laravel-site
Package laravel-site
Short Description A foundation to build Websites using Laravel, including reusable view components.
License MIT
Homepage https://github.com/antonioprimera/laravel-site
Informations about the package laravel-site
A foundation to build configurable Websites using Laravel
This package provides the basic building blocks to create a configurable website using Laravel and Filament as the admin panel, where you can maintain the text and images of your website.
It provides the following models:
- Site: A Site is a collection of Pages and holds a settings container, that can be used to store global settings for the site.
- Page: A Page is a collection of Sections
- Section: A Section is a collection of Bits
- Bit: A Bit is a data container, that can be used to store parts of site sections.
All models have a uid
attribute, used to identify and retrieve the models. The uid
is a string that should be unique
within the model type. For example, in order to identify a model, you would use the Site Facade or the helpers:
The Section and the Bit models have a single spatie media 'image', so you can easily associate images with them.
This package provides abstract classes for building Page, Section and Bit View Components, that can be used to render the models in your views. You can extend these classes to create your own View Components. You can use the following bash commands to generate new View Components:
Additionally, you can use the antonioprimera/laravel-site-components package to get some pre-built components and artisan commands to create new View Components for Sections and Bits.
The models use spatie/laravel-medialibrary
to store images and spatie/laravel-translatable
to make
the title and contents translatable.
Installation
You can install the package via composer:
Publish the migrations and run them:
You can publish the config file with:
This is the contents of the published config file:
Usage
The package offers the following main features:
- Site, Page, Section and Bit models, to store and retrieve the data for your website
- View Component generators for Pages, Sections and Bits, so you can easily create new View Components and use the models in your views
- Data migrations, to seed the database with site data (Site, Pages, Sections and Bits using the SiteBuilder, PageBuilder, SectionBuilder and BitBuilder classes)
- Site Facade and helper functions to retrieve the models by their uid and to handle the site locales
Create new data migrations
These migration files are stored in the database/site-migrations
directory and can are run using the artisan migrate
together with your standard laravel migrations.
You can use the SiteBuilder
, PageBuilder
, SectionBuilder
and BitBuilder
classes to create new models in your data
migrations, which provide a fluent interface to create, update and delete the models.
Here's an example of a data migration file, which creates a Site, a Page and a Section model with 2 Bit models attached to it:
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-site with dependencies
laravel/framework Version >=11.0
antonioprimera/laravel-generator-command Version ^3.0
spatie/laravel-medialibrary Version ^11.8
spatie/laravel-package-tools Version ^1.16
spatie/laravel-translatable Version ^6.8