Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Site Laravel Package

laravel-admin/site

Laravel package that adds a “site” singleton to the service container for storing app-wide data (supports dot notation). Includes defaults via config, can populate values from a model, and shares the container with all views as $site.

View on GitHub
Deep Wiki
Context7

Site container for your Laravel Project

This package creates a singleton into the Service container. In this site container you can put from your whole application items.

At the end the container will be added as a shared view variable.

Installation

Install it with composer

composer require laravel-admin/site

Add the Service Provider to your config/app.php

LaravelAdmin\Site\SiteServiceProvider::class,

The package has a config, with a basic structure. Publish this config to define your defaults.

artisan vendor:publish --tag="site"

Usage

The container is available in the whole application with:

app('site')

Add item to the container

app('site')->set('title', 'My website title');

Add subitem to the container

The container is compatible with the dotted array notation, like config

app('site')->set('seo.title', 'This is my SEO improved title');

Get item

app('site')->get('title');

Get sub item

app('site')->get('seo.title');

Add your model

Imagine you have a model with some default content attributes, like title, description and content. With one command you can fill all items in the container.

app('site')->model($post);

Views

The container will be available in all your views as the $site variable. Use it as follow:

{{ $site->get('title') }}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
althinect/enum-permission
andydefer/laravel-actions
aimeos/prisma
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor