定制 jobmetric/laravel-metadata 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jobmetric/laravel-metadata

Composer 安装命令:

composer require jobmetric/laravel-metadata

包简介

This package is for the metadata of different Laravel projects.

README 文档

README

Contributors Forks Stargazers MIT License LinkedIn

Laravel Metadata

Manage Metadata. Simply and Flexibly.

Laravel Metadata simplifies storing dynamic key-value data for your Eloquent models. Stop modifying database schemas for every new field and start managing extensible data with ease. It provides a robust and flexible metadata system that enables you to attach dynamic key-value data to any model through a polymorphic relationship—perfect for storing custom fields, settings, options, and user-defined attributes without modifying your database schema. This is where powerful metadata management meets developer-friendly simplicity—giving you complete control over dynamic data without the complexity.

Why Laravel Metadata?

Dynamic Key-Value Storage

Laravel Metadata allows you to store arbitrary key-value pairs for any Eloquent model without modifying the model's table structure. This is perfect for storing custom fields, user preferences, product attributes, and any other extensible data.

Polymorphic Relationships

The package uses Laravel's polymorphic relationships, allowing a single metas table to store metadata for multiple model types. This keeps your database schema clean and maintainable while providing maximum flexibility.

Key Whitelisting

Control which metadata keys are allowed for each model. Define a whitelist of allowed keys to prevent typos and ensure data integrity, or use ['*'] to allow all keys.

Automatic JSON Handling

Arrays and objects are automatically JSON-encoded when stored and decoded when retrieved. The package tracks which values are JSON, ensuring proper type handling.

What is Metadata Management?

Metadata management is the process of storing and retrieving additional information about your models that doesn't fit into the main table structure. Traditional approaches often require:

  • Adding columns to tables (inflexible)
  • Creating separate tables for each model (redundant)
  • Using JSON columns (limited querying)

Laravel Metadata solves these challenges by providing:

  • Polymorphic Storage: One table for all metadata across all models
  • Dynamic Keys: Add new metadata keys without schema changes
  • Type Safety: Automatic JSON encoding/decoding
  • Query Support: Filter and search by metadata
  • Key Control: Whitelist allowed keys per model

Consider an e-commerce system where products need different attributes based on their category. With Laravel Metadata, you can store category-specific attributes dynamically, query products by these attributes, and manage them through a simple API. The power of metadata management lies not only in flexible storage but also in making it easy to query, filter, and manage throughout your application.

What Awaits You?

By adopting Laravel Metadata, you will:

  • Store extensible data - Add custom fields without schema changes
  • Simplify data management - One table for metadata across all models
  • Improve flexibility - Dynamic keys that adapt to your needs
  • Enhance querying - Filter and search by metadata values
  • Maintain data integrity - Key whitelisting prevents errors
  • Maintain clean code - Simple, intuitive API that follows Laravel conventions

Quick Start

Install Laravel Metadata via Composer:

composer require jobmetric/laravel-metadata

Documentation

Ready to transform your Laravel applications? Our comprehensive documentation is your gateway to mastering Laravel Metadata:

📚 Read Full Documentation →

The documentation includes:

  • Getting Started - Quick introduction and installation guide
  • HasMeta - Core trait for adding metadata functionality to models
  • HasFilterMeta - Dynamic filtering capabilities based on metadata
  • HasDynamicMeta - Integration with custom field systems
  • Resources - API response transformation
  • Events - Hook into metadata lifecycle
  • Real-World Examples - See how it works in practice

Contributing

Thank you for participating in laravel-metadata. A contribution guide can be found here.

License

The laravel-metadata is open-sourced software licensed under the MIT license. See License File for more information.

jobmetric/laravel-metadata 适用场景与选型建议

jobmetric/laravel-metadata 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 122 次下载、GitHub Stars 达 10, 最近一次更新时间为 2024 年 01 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 jobmetric/laravel-metadata 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jobmetric/laravel-metadata 我们能提供哪些服务?
定制开发 / 二次开发

基于 jobmetric/laravel-metadata 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 122
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 7
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-05