icanboogie / activerecord
ActiveRecord Object-relational mapping
Requires
- php: >=8.2
- ext-pdo: *
- icanboogie/common: ^6.0
- icanboogie/datetime: ^3.0
- icanboogie/inflector: ^3.0
- icanboogie/prototype: ^6.0
- icanboogie/validate: ^6.0
Requires (Dev)
- ext-pdo_mysql: *
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Connections, models and active records are the foundations of everything that concerns database access and management. They are used to establish database connections, manage tables and their relationships, as well as manage the records of these tables. Leveraging OOP, models and active records are classes whose properties, getters/setters, and behavior can be inherited in a business logic.
Using the query interface, you won't have to write raw SQL, manage table relationships, or worry about injection.
Finally, using registries you can define all your connections and models in a single place. Connections are established and models are instantiated on demand, so feel free to define hundreds of them.
Requirements
- PHP 8.4+
- The
pdoextension, with the driver of your database: SQLite, MySQL, or PostgreSQL.
Installation
composer require icanboogie/activerecord
To use the package with the ICanBoogie framework, install icanboogie/bind-activerecord instead.
Documentation
- Getting started
- Configuration
- Connections
- Schema
- Relations
- Models
- Installing models
- Active records
- The query interface
- Exceptions
- Database engines
- Architecture decision records
See CHANGELOG for the changes between versions, and how to upgrade.
Acknowledgments
The implementation of the query interface is vastly inspired by Ruby On Rails' Active Record Query Interface.
Continuous Integration
The project is continuously tested by GitHub Actions.
Code of Conduct
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.
Contributing
See CONTRIBUTING for details.