fsi/metadata
DEPRECATED: do not use. FSi Metadata Component reads class configuration metadata from sources like annotations (currently PHP annotations only). Provides a ClassMetadata object and abstract drivers (e.g., annotation driver) to store class/property/method metadata.
AnnotationReader and Doctrine\Common\Cache, which require adapters for Laravel’s Illuminate\Contracts\Cache\Store and doctrine/annotations (v1.14+). Laravel’s native attributes (PHP 8+) and service container reduce the need for this package’s abstraction layer.ClassMetadataInterface allows customization, Laravel’s events (e.g., ModelCreating) or deferred services could replace manual metadata loading.doctrine/annotations + a polyfill for Symfony’s Annotation trait (conflicts with PHP 8 attributes). Example:
use Doctrine\Common\Annotations\Annotation\Target;
#[Attribute(Attribute::TARGET_PROPERTY)]
class Field { ... } // Laravel Attribute + Doctrine-compatible
symfony/yaml/spatie/array-to-xml, adding dependency bloat. Laravel’s native config (JSON/YAML) or spatie/laravel-config-array may suffice.Cache facade supports multiple backends, but the package’s Doctrine\Common\Cache interface demands a custom adapter (e.g., LaravelCacheAdapter).Attribute + Reflection) is recommended.bootstrap/cache) mitigate this, but caching strategies (e.g., ApcCache) may not align.ContainerAware) require mocking or rewrites, increasing testing overhead.Value Proposition:
Alternatives:
#[Attribute] + ReflectionAttribute.Laravel\SerializableClosure).nWidart/annotation (Symfony annotations in Laravel) or illuminate/support utilities.Migration Path:
doctrine/annotations:v1.14 + a wrapper to adapt AnnotationReader to Laravel’s Annotation classes.symfony/yaml/spatie/array-to-xml, but parse once at boot (e.g., in a ServiceProvider) and cache results.DoctrineCacheAdapter for Laravel’s Cache facade:
class LaravelCacheAdapter implements \Doctrine\Common\Cache\Cache {
public function __construct(private \Illuminate\Contracts\Cache\Store $cache) {}
public function fetch($id) { return $this->cache->get($id); }
// Implement remaining methods...
}
MetadataFactory as a Laravel service provider:
$this->app->singleton(MetadataFactory::class, function ($app) {
$driver = new AnnotationDriver($app->make(AnnotationReader::class));
$cache = new LaravelCacheAdapter($app->make('cache.store'));
return new MetadataFactory($driver, $cache, 'laravel-metadata');
});
ClassMetadataInterface to a custom implementation (e.g., LaravelClassMetadata) for Laravel-specific extensions.doctrine/annotations + a minimal adapter.symfony/yaml and cache integration.Annotation trait with Laravel’s #[Attribute].ClassMetadataInterface to support Laravel’s events (e.g., ModelCreated) or policies.Attribute + Reflection).Annotation trait; use polyfills or migrate to attributes.Attribute support reduces dependency on this package.doctrine/annotations and doctrine/cache (or adapters).Attribute + Reflection).Cache facade via adapter.ClassMetadataInterface for Laravel-specific needs (e.g., Eloquent events).symfony/yaml, doctrine/annotations, and custom adapters increases composer.json size and build time.Annotation trait may break in PHP 8.2+.doctrine/annotations or symfony/yaml may introduce security vulnerabilities.AnnotationReader and Doctrine\Common\Cache.Cache facade and doctrine/annotations integration.DoctrineCacheAdapter.ClassMetadataInterface customization.Recommendation: Avoid adoption unless legacy Symfony 2 annotations are critical. Prefer Laravel’s native Attribute + Reflection or packages like nWidart/annotation. If adopted, fork and maintain with a clear migration path to native tools.
How can I help you explore Laravel packages today?