Download the PHP package casbin/dbal-adapter without Composer

On this page you can find all versions of the php package casbin/dbal-adapter. 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 dbal-adapter

Doctrine DBAL Adapter for Casbin

PHPUnit Coverage Status Latest Stable Version Total Downloads License

Doctrine DBAL Adapter for PHP-Casbin, Casbin is a powerful and efficient open-source access control library.

The following database vendors are currently supported:

Installation

Via Composer.

Basic Usage (Without Redis Caching)

This section describes how to use the adapter with a direct database connection, without leveraging Redis for caching.

You can initialize the adapter by passing either a Doctrine DBAL connection parameter array or an existing Doctrine\DBAL\Connection instance to the Adapter::newAdapter() method or the Adapter constructor.

Example:

Usage with Redis Caching

To improve performance and reduce database load, the adapter supports caching policy data using Redis. When enabled, Casbin policies will be fetched from Redis if available, falling back to the database if the cache is empty.

To enable Redis caching, provide a Redis configuration array as the second argument when initializing the adapter. The first argument remains your Doctrine DBAL connection (either a parameters array or a Connection object).

Redis Configuration Options:

Example:

Cache Preheating

The adapter provides a preheatCache() method to proactively load all policies from the database and store them in the Redis cache. This can be useful during application startup or as part of a scheduled task to ensure the cache is warm, reducing latency on initial policy checks.

Example:

Cache Invalidation

The cache is designed to be automatically invalidated when policy-modifying methods are called on the adapter (e.g., addPolicy(), removePolicy(), savePolicy(), etc.). Currently, this primarily clears the cache key for all policies ({$prefix}all_policies).

Important Note: The automatic invalidation for filtered policies (policies loaded via loadFilteredPolicy()) is limited. Due to the way predis/predis client works and to avoid using performance-detrimental commands like KEYS * in production environments, the adapter does not automatically delete cache entries for specific filters by pattern. If you rely heavily on loadFilteredPolicy and make frequent policy changes, consider a lower TTL for your Redis cache or implement a more sophisticated cache invalidation strategy for filtered results outside of this adapter if needed. The main {$prefix}all_policies cache is cleared on any policy change, which means subsequent calls to loadPolicy() will refresh from the database and update this general cache.

Getting Help

License

This project is licensed under the Apache 2.0 license.


All versions of dbal-adapter with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
casbin/casbin Version ^4.0
doctrine/dbal Version ^3.9|^4.0
predis/predis Version ^2.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 casbin/dbal-adapter contains the following files

Loading the files please wait ....