Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Accessible Laravel Package

antares/accessible

View on GitHub
Deep Wiki
Context7

Configuration

Use a custom annotations reader

The default annotations reader used by this library does only cache the annotations in memory, so it will parse your class files each time a request runs. This is quite slow, and you should use a reader that caches the result between requests. With the following piece of code, the result will be cached in the memory plus the filesystem.

$cache = new Doctrine\Common\Cache\ChainCache([
    new Doctrine\Common\Cache\ArrayCache(),
    new Doctrine\Common\Cache\FilesystemCache("cache/")
]);

Accessible\Configuration::setAnnotationReader(
    new Doctrine\Common\Annotations\CachedReader(
        new Doctrine\Common\Annotations\AnnotationReader(),
        $cache,
        $debug = false
    )
);

Note that the FilesystemCache cache is not optimal, and if you can, you should better use a faster cache. Here is an example with ApcCache:

$cache = new Doctrine\Common\Cache\ChainCache([
    new Doctrine\Common\Cache\ArrayCache(),
    new Doctrine\Common\Cache\ApcCache()
]);

// ...

Use a custom constraints validator

If you are already using the Symfony validator in your code, you may want this library to use it, as one validator is enough. You can set which validator will be used this way:

Accessible\Configuration::setConstraintsValidator(
    Validation::createValidatorBuilder()
        ->enableAnnotationMapping()
        ->getValidator()
);

Use a custom cache driver

You can use a cache in order to avoid the use of the annotation parser whenever possible. This will improve the performance.

Accessible\Configuration::setCacheDriver(
    new Doctrine\Common\Cache\ApcCache()
);

Note that an another cache is used to store the annotations information in the memory, so that every class is parsed only once per request. So, if you add a custom cache driver, for each time the script is launched, the annotations information will be extracted first from the cache driver, and then directly from the memory.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle