Before you begin, ensure your development environment meets the following requirements:
spiral/cycle-bridge
official Cycle ORM adapter for the Spiral Framework
yiisoft/yii-cycle
— official Cycle ORM adapter for the Yii 3
wayofdev/laravel-cycle-orm-adapter
— package managed by @wayofdev for the Laravel 10.x or higher.The preferred way to install this package is through Composer.
composer require cycle/active-record
After package install you need to, optionally, register bootloader (service-provider) in your application.
If you are installing the package on the Spiral Framework with the spiral-packages/discoverer package, then you don't need to register Bootloader by yourself. It will be registered automatically.
Otherwise, update the Bootloader list in your application configuration:
class Kernel extends \Spiral\Framework\Kernel
{
public function defineBootloaders(): array
{
return [
// ...
// ORM
CycleBridge\SchemaBootloader::class,
CycleBridge\CycleOrmBootloader::class,
CycleBridge\AnnotatedBootloader::class,
// ActiveRecord
ActiveRecordBootloader::class,
// ...
];
}
For more information about bootloaders, refer to the Spiral Framework documentation.
If you are using Laravel, then you don't need to register service-provider by yourself. It will be registered automatically.
For configuration instructions refer to yii-cycle installation guide.
This package uses PSR-11 compatible container
to resolve dependencies. After container initialization you need to pass container
instance to the static facade:
\Cycle\ActiveRecord\Facade::setContainer($container);