System requirements
Before installing GAC, ensure your system meets these requirements:- PHP: 8.0 or higher
- Database: MySQL 5.7+ or MariaDB 10.2+
- PHP Extensions: PDO, pdo_mysql
- Composer: Latest stable version
Install via Composer
Install GAC using Composer by running this command in your project directory:The package is registered as
dancasdev/gac on Packagist and follows semantic versioning.Database setup
GAC requires several database tables to store permissions, roles, and restrictions. Import the provided SQL schema into your database.Download the schema
The
tables.sql file is included in the package at vendor/dancasdev/gac/tables.sqlReview the schema
Examine the tables to understand the structure. You can customize certain tables like
gac_user and glb_person to fit your applicationUsing MySQL command line
Using PHP
Database schema overview
The schema creates the following core tables:Permission tables
Permission tables
gac_module_category- Categories for grouping modulesgac_module- Individual modules/features in your applicationgac_module_access- Permission assignments to users, clients, and roles
Role tables
Role tables
gac_role- Role definitionsgac_role_entity- Role assignments to users and clients with priority levels
Restriction tables
Restriction tables
gac_restriction_category- Categories of restrictions (by_date, by_branch, etc.)gac_restriction_method- Specific restriction methods within categoriesgac_restriction- Restriction assignments to entities
Entity tables
Entity tables
gac_user- User accounts (customizable)gac_client- API clients/external systems (customizable)glb_person- Person directory (customizable)
The
gac_user, gac_client, and glb_person tables are provided as examples. You can modify these tables or use your existing user tables by implementing custom database adapters.Verify installation
Verify that GAC is installed correctly by checking if the classes can be autoloaded:Package structure
Once installed, GAC’s source code is organized as follows:Configuration options
GAC requires minimal configuration. You’ll primarily work with:- Database connection - PDO instance or connection array
- Cache settings - Optional cache directory and TTL
- Entity configuration - User or client identification
Next steps
With GAC installed and your database configured, you’re ready to start using the library.Quickstart guide
Learn how to configure GAC and perform your first permission check