actiophp / actio
Logging and reporting of activities and events
v0.2.2
2025-03-24 07:20 UTC
Requires
- php: ^8.3
- psr/log: ^3.0
Requires (Dev)
- ext-pdo: *
- fakerphp/faker: ^1.23
- phpstan/phpstan: ^1.10
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^11.0
- symfony/dotenv: ^7.2
- symfony/process: ^7.2
README
Installation
Install the latest version:
composer require actiophp/actio
Usage
Actio::setHandler($handler);
Tests
Running Tests
Run all tests with coverage:
composer test
Or run specific test suites:
composer test:unit # Unit tests only composer test:integration # Integration tests only
Integration Tests
Integration tests require local MySQL and PostgreSQL instances.
MySQL Setup
Configure your MySQL test database:
CREATE USER 'test'@'localhost' IDENTIFIED BY 'password1'; CREATE DATABASE actio_test; GRANT ALL PRIVILEGES ON actio_test.* TO 'test'@'localhost'; FLUSH PRIVILEGES;
MySQL environment variables in .env.testing
:
- ACTIO_MYSQL_HOST (default: localhost)
- ACTIO_MYSQL_DB_NAME (default: actio_test)
- ACTIO_MYSQL_USERNAME (default: test)
- ACTIO_MYSQL_PASSWORD (default: password1)
PostgreSQL Setup
Configure your PostgreSQL test database:
# Create test user and database sudo -u postgres psql -c "CREATE USER test WITH PASSWORD 'password1';" sudo -u postgres psql -c "CREATE DATABASE test WITH OWNER test;" # Create schema for Actio tests sudo -u postgres psql -d test -c "CREATE SCHEMA actio_test AUTHORIZATION test;" sudo -u postgres psql -d test -c "GRANT ALL ON SCHEMA actio_test TO test;"
PostgreSQL environment variables in .env.testing
:
- ACTIO_PG_HOST (default: localhost)
- ACTIO_PG_DB_NAME (default: test)
- ACTIO_PG_SCHEMA (default: actio_test)
- ACTIO_PG_USERNAME (default: test)
- ACTIO_PG_PASSWORD (default: password1)
Static Analysis
Run PHPStan (level 8):
composer phpstan
Credits
Code and ideas borrowed from https://github.com/jbroadway/analog