Download the PHP package wakebit/cycle-bridge without Composer
On this page you can find all versions of the php package wakebit/cycle-bridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cycle-bridge
Cycle ORM bridge
This package provides a set of Symfony commands, classes for integration Cycle ORM with any framework. We are supporting integration both versions of the ORM. If you want to integrate this to Laravel we already have a separated package which uses this bridge.
Requirements
- PHP >= 8.0
- Cycle ORM 1 or 2 (branches
v1.x
andv2.x
accordingly)
Installation
- Install the package via composer:
Example of usage with PHP-DI
-
Declare config
config/config.php
and fill database credentials: -
Declare ORM config
config/cycle.php
. Dont forget to set up correct paths to entities path, migrations path: -
Declare dependencies for PHP-DI container
config/container.php
: - Now, you need to load a dependencies array created in the step above to PHP-DI. After you are free to use dependencies, write your code.
Let's look at quick example. Define entity:
You can take DBAL, ORM and EntityManager from the container. Quick example of usage:
See more on the official Cycle ORM documentation.
Console commands
Working with ORM schema
Command | Description | Options | Symfony command class FQN |
---|---|---|---|
cycle:schema:migrate |
Generate ORM schema migrations | - --run : Automatically run generated migration.- -v : Verbose output. |
\Wakebit\CycleBridge\Console\Command\Schema\MigrateCommand::class |
cycle:schema:cache |
Compile and cache ORM schema | \Wakebit\CycleBridge\Console\Command\Schema\CacheCommand::class |
|
cycle:schema:clear |
Clear cached schema (schema will be generated every request now) | \Wakebit\CycleBridge\Console\Command\Schema\ClearCommand::class |
|
cycle:schema:sync |
Sync ORM schema with database without intermediate migration (risk operation!) | \Wakebit\CycleBridge\Console\Command\Schema\SyncCommand::class |
|
cycle:schema:render |
Render available CycleORM schemas. | - --no-color : Display output without colors. |
\Wakebit\CycleBridge\Console\Command\Schema\RenderCommand::class |
Database migrations
Command | Description | Options | Symfony command class FQN |
---|---|---|---|
cycle:migrate:init |
Initialize migrator: create a table for migrations | \Wakebit\CycleBridge\Console\Command\Migrate\InitCommand::class |
|
cycle:migrate |
Run all outstanding migrations | - --one : Execute only one (first) migration.- --force : Force the operation to run when in production. |
\Wakebit\CycleBridge\Console\Command\Migrate\MigrateCommand::class |
cycle:migrate:rollback |
Rollback the last migration | - --all : Rollback all executed migrations.- --force : Force the operation to run when in production. |
\Wakebit\CycleBridge\Console\Command\Migrate\RollbackCommand::class |
cycle:migrate:replay |
Replay (down, up) one or multiple migrations. | - --all : Replay all migrations. |
\Wakebit\CycleBridge\Console\Command\Migrate\ReplayCommand::class |
cycle:migrate:status |
Get a list of available migrations | \Wakebit\CycleBridge\Console\Command\Migrate\StatusCommand::class |
Database commands
Command | Description | Options | Symfony command class FQN |
---|---|---|---|
cycle:db:list |
Get list of available databases, their tables and records count | - --database : Database name |
\Wakebit\CycleBridge\Console\Command\Database\ListCommand::class |
cycle:db:table <table> |
Describe table schema of specific database | - --database : Database name |
\Wakebit\CycleBridge\Console\Command\Database\TableCommand::class |
Writing functional tests
If you are using memory database (SQLite) you can just run migrations in the setUp
method of the your test calling the console command cycle:migrate
.
For another databases follow this instruction and drop all tables in the tearDown
method.
Advanced
Manually defined ORM schema
If you want to use a manually defined ORM schema you can define it in the cycle.php
orm.schema.map
config key:
Manually defined schema should be presented as array. It will be passed to \Cycle\ORM\Schema
constructor. See more here.
Custom schema compilation pipeline
You can redefine the ORM schema compilation generators in the cycle.php
orm.schema.generators
config key:
Classes will be resolved by DI container. Default pipeline you can see here.
Default collection factory
You can specify predefined or your own collection factory in container definition:
Credits
- Cycle ORM, PHP DataMapper ORM and Data Modelling Engine by SpiralScout.
- Spiral Scout, author of the Cycle ORM.
- Spiral Framework Cycle Bridge for code samples, example of usage.
All versions of cycle-bridge with dependencies
cycle/annotated Version ^3.0
cycle/database Version ^2.0
cycle/migrations Version ^3.0
cycle/orm Version ^2.0
cycle/schema-builder Version ^2.0
cycle/schema-migrations-generator Version ^2.0
cycle/schema-renderer Version ^1.1
psr/container Version ^1.0|^2.0
psr/simple-cache Version ^1.0|^2.0|^3.0
spiral/core Version ^2.9
symfony/console Version ^5.1|^6.0