2.0.0 2021-06-23 14:52 UTC

This package is auto-updated.

Last update: 2021-10-25 04:04:25 UTC



Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

This package was created by, and is maintained by Brian Faust, and provides an easy way of storing generic data that is resolved based on the location.


composer require konceiver/laravel-data-bags


Registration & Resolving

use Konceiver\DataBags\DataBag;

DataBag::register('meta', [
    'users' => ['title' => 'Users'],
    '*'     => ['title' => 'Placeholder'],

Route::get('users', function ($id) {
    // This will return ['title' => 'Users']
    return DataBag::resolveByPath('meta');

Route::get('/', function ($id) {
    // This will return ['title' => 'Placeholder']
    return DataBag::resolveByPath('meta');

Blade Component

For convenience we offer a Blade component that will make it easy for you to include resolved data into views. We'll use meta tags as an example.

Register bag

use Konceiver\DataBags\DataBag;

DataBag::register('meta', [
    '/' => [
        'title'       => 'My Website',
        'description' => 'Posts, Media & More',

Route::get('home', function ($id) {
    return view('home');

Create metatag component

<meta property="og:title" content="{{ $title }}" />
<meta property="og:description" content="{{ $description }}">

Include data bag component

<x-data-bag key="meta" resolver="path" view="components.meta" />


composer test


Please see CHANGELOG for more information on what has changed recently.


Please see CONTRIBUTING for details.


If you discover a security vulnerability within this package, please send an e-mail to security@konceiver.dev. All security vulnerabilities will be promptly addressed.


This project exists thanks to all the people who contribute.

Support Us

We invest a lot of resources into creating and maintaining our packages. You can support us and the development through GitHub Sponsors.


Laravel Data Bags is an open-sourced software licensed under the MIT.