Download the PHP package solution-forest/laravel-dynamic-properties without Composer

On this page you can find all versions of the php package solution-forest/laravel-dynamic-properties. 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-dynamic-properties

Laravel Dynamic Properties

Tests Code Style Latest Stable Version License

A dynamic property system for Laravel that allows any entity (users, companies, contacts, etc.) to have custom properties with validation, search capabilities, and optimal performance.

Requirements

Features

Installation

Install the package via Composer:

Publish and run the migrations:

Optionally, publish the configuration file:

Quick Start

⚠️ IMPORTANT: You must create Property definitions before setting property values. Attempting to set a property that doesn't have a definition will throw a PropertyNotFoundException.

1. Add the Trait to Your Models

2. Create Properties

⚠️ REQUIRED STEP: Before setting any property values, you must first create the property definitions. This ensures type safety, validation, and optimal performance.

3. Set and Get Properties

✅ Only after creating property definitions can you set values:

💡 Pro Tip: Use the Artisan command to create properties interactively:

4. Search by Properties

🔍 Search works with or without property definitions, but defining properties first is strongly recommended for type safety:

⚠️ Common Pitfalls and Warnings

1. Property Definition Required for Setting Values

2. Type Safety Depends on Property Definitions

3. Validation Only Works with Property Definitions

4. Performance Impact

Advanced Usage

Property Types and Validation

Text Properties

Number Properties

Date Properties

Boolean Properties

Select Properties

Performance Optimization

JSON Column Caching

For maximum performance, add a JSON column to your existing tables:

This provides:

Search Performance

The package automatically creates optimized indexes:

Advanced Search

Complex Queries

Text Search

Error Handling

The package provides comprehensive error handling:

Artisan Commands

The package includes helpful Artisan commands:

API Reference

HasProperties Trait

Methods

setDynamicProperty(string $name, mixed $value): void

getDynamicProperty(string $name): mixed

setProperties(array $properties): void

getPropertiesAttribute(): array

Magic Methods

__get($key): mixed

__set($key, mixed $value): void

Query Scopes

whereProperty(string $name, mixed $value, string $operator = '='): Builder

whereProperties(array $properties): Builder

PropertyService

setDynamicProperty(Model $entity, string $name, mixed $value): void

setProperties(Model $entity, array $properties): void

search(string $entityType, array $filters): Collection

Performance Characteristics

Single Entity Property Retrieval

Method Performance Use Case
JSON Column Cache < 1ms Entities with many properties (50+)
EAV Fallback < 20ms Entities with few properties
Mixed Access Automatic Transparent performance optimization

Search Performance

Dataset Size Single Property Multiple Properties Full-Text Search
1K entities < 10ms < 50ms < 100ms
10K entities < 50ms < 200ms < 500ms
100K entities < 200ms < 1s < 2s

Memory Usage

Database Compatibility

MySQL (Recommended)

SQLite

Configuration

Publish the config file to customize behavior:

Troubleshooting

Common Errors and Solutions

PropertyNotFoundException

Solution: Create the property definition first:

PropertyValidationException

Solution: Check property validation rules:

Inconsistent Search Results

Solution: This happens when property definition is missing. Create it:

Testing

The package includes comprehensive tests. Run them with:

Contributing

Please see CONTRIBUTING.md for details on how to contribute to this project.

License

This package is open-sourced software licensed under the MIT license.

Changelog

Please see CHANGELOG.md for recent changes.

Documentation

Credits


All versions of laravel-dynamic-properties with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 solution-forest/laravel-dynamic-properties contains the following files

Loading the files please wait ...