Download the PHP package banulakwin/laravel-metadata without Composer

On this page you can find all versions of the php package banulakwin/laravel-metadata. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-metadata

Laravel Metadata (banulakwin/laravel-metadata)

Latest Version on Packagist Tests Total Downloads

Portable Laravel package: config-driven application metadata stored as key/value rows per group, with typed field definitions in PHP config and a sync command that inserts missing rows from defaults.

Use this for site settings, feature flags, integration toggles, and other global key/value data without new migrations when you add keys.


Requirements


Installation

Registration is automatic via Composer extra.laravel.providers:

Optional facade alias (see Resolving MetadataService): MetaBanulakwin\Metadata\Facades\Meta.

Configure, migrate, sync

Tag Copies
meta-config config/meta.php — define groups and fields (types + defaults)
metadata-config config/metadata.php — migration registration
metadata-migrations Package migration files → database/migrations/ (optional; see Database migrations below)

Database migrations

By default, migrations are registered with loadMigrationsFrom() when config('metadata.register_migrations') is true (default). Run php artisan migrate — no publish step is required.

To own migrations in the app: publish with php artisan vendor:publish --tag=metadata-migrations, then set register_migrations => false in config/metadata.php (or METADATA_REGISTER_MIGRATIONS=false in .env) so Laravel does not load the same files twice.


Configuration overview

config/meta.php (merged key: meta)

Top-level keys are group names (e.g. site, integrations). Each group has a fields array: field key → definition with at least type, optional default.

Supported types for meta:sync (default encoding) and MetadataService::get() / getGroupDecoded() (decoding):

Type Stored in DB Notes
text, textarea, url, email Plain string Default: empty string if omitted.
image String path or null Same idea as page-builder image path.
integer / int Numeric string or null Default omitted → null in DB.
float / decimal / double Numeric string or null Default omitted → null in DB.
boolean / bool JSON boolean string (true / false) Uses json_encode for storage.
json JSON string default is json_encoded.
repeater JSON array Same pattern as page-builder repeaters.
group JSON object Nested fields with recursive defaults (like page-builder group).

Optional default is used by php artisan meta:sync only when creating a missing row (existing values are never overwritten).

config/metadata.php (merged key: metadata)

Config key Purpose
register_migrations Load package migrations via loadMigrationsFrom() (default true). Set false after publishing migrations into the app. Env: METADATA_REGISTER_MIGRATIONS.
definitions Optional inline group definitions (same shape as meta); merged after config('meta').
definitions_path Absolute path, or empty string to use app/Cms/Metadata. Each {group}.php returns ['fields' => [...]]; basename is the group name. Env: METADATA_DEFINITIONS_PATH.
definitions_cache_ttl Seconds to cache merged definitions (0 = off). meta:sync clears this cache when TTL is greater than zero. Env: METADATA_DEFINITIONS_CACHE_TTL.
definitions_cache_key Cache store key for merged definitions. Env: METADATA_DEFINITIONS_CACHE_KEY.

MetadataRegistry (file + config merge)

Banulakwin\Metadata\Support\MetadataRegistry mirrors the page-builder idea: all() returns merged groups (for meta:sync and for MetadataService field types). fieldsForGroup('site') returns the fields map for one group. forgetCache() is called at the start of meta:sync.


Rules (design constraints)


Database

Table: metadata_entries

Column Notes
group Logical namespace (site, integrations, …)
key Field name
value longText, nullable — scalar string or JSON for complex types
deleted_at Nullable timestamp — soft deletes (SoftDeletes on MetadataEntry)

Unique index: (group, key) (applies to soft-deleted rows too). meta:sync uses withTrashed()->firstOrCreate() so it does not insert a duplicate when a trashed row still exists; if the row was trashed, it is restore()d (defaults are not written over existing values).


Architecture

Model

Banulakwin\Metadata\Models\MetadataEntry — fillable: group, key, value; uses SoftDeletes (deleted_at).

Metadata service (singleton)

Banulakwin\Metadata\Services\MetadataService:

Method Returns
getGroup(string $group) [key => raw string or null] from the database
getRaw(string $group, string $key) Single raw value or null
get(string $group, string $key, mixed $default = null) Value decoded using registry field type when defined; otherwise raw string
getGroupDecoded(string $group) All keys in that group with decoding applied where config exists

Resolving MetadataService (prefer dependency injection)

Recommended — method injection:

Optional — facade:

Optional — global helper (meta_group('site')) returns raw pairs only; use sparingly. Prefer MetadataService or Meta::getGroupDecoded() when you need typed values.

Sync command

php artisan meta:sync walks config('meta') and uses firstOrCreate on (group, key) with encoded defaults. Does not overwrite existing rows.

Helper

meta_group(string $group): array — convenience wrapper around MetadataService::getGroup() (raw strings). Defined in src/helpers.php (Composer autoload.files).


Laravel / Inertia usage

Controller (read, typed)

React (Inertia props)

Scalars arrive as strings/numbers/booleans/objects depending on type and get() / getGroupDecoded(). JSON-backed fields are already decoded on the server when you use get() or getGroupDecoded().


Example config shape

After publishing meta-config, define groups in config/meta.php. Minimal example:


Testing


Changelog

See CHANGELOG.md for details.


Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/your-feature)
  3. Run composer quality to ensure tests and style pass
  4. Commit and push
  5. Open a pull request

Package layout (reference)


License

MIT


All versions of laravel-metadata with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package banulakwin/laravel-metadata contains the following files

Loading the files please wait ...