cycle/annotated
Define Cycle ORM entities and schema using PHP 8 attributes. Annotate columns, primary keys, enums, decimals, and relationships like HasOne, HasMany, and BelongsTo, then let Cycle build the mapping from your code.
Full Changelog: https://github.com/cycle/annotated/compare/v4.5.0...v4.6.0
Full Changelog: https://github.com/cycle/annotated/compare/v4.4.1...v4.5.0
Full Changelog: https://github.com/cycle/annotated/compare/v4.4.0...v4.4.1
Full Changelog: https://github.com/cycle/annotated/compare/v4.3.1...v4.4.0
Full Changelog: https://github.com/cycle/annotated/compare/v4.3.0...v4.3.1
Full Changelog: https://github.com/cycle/annotated/compare/v4.2.5...v4.3.0
Full Changelog: https://github.com/cycle/annotated/compare/v4.2.4...v4.2.5
Full Changelog: https://github.com/cycle/annotated/compare/v4.2.3...v4.2.4
Full Changelog: https://github.com/cycle/annotated/compare/v4.2.2...v4.2.3
Full Changelog: https://github.com/cycle/annotated/compare/v4.2.1...v4.2.2
Full Changelog: https://github.com/cycle/annotated/compare/v4.2.0...v4.2.1
SingleTable attribute by @vjik in https://github.com/cycle/annotated/pull/103Full Changelog: https://github.com/cycle/annotated/compare/v4.1.0...v4.2.0
unsigned and zerofill attributes by @msmakouz in https://github.com/cycle/annotated/pull/94Full Changelog: https://github.com/cycle/annotated/compare/v4.0.0...v4.1.0
Full Changelog: https://github.com/cycle/annotated/compare/v3.4.0...v3.5.0
doctrine/annotations has been moved to the require-dev section by @msmakouz in https://github.com/cycle/annotated/pull/73AttributeReader was set as the default reader by @msmakouz in https://github.com/cycle/annotated/pull/93Full Changelog: https://github.com/cycle/annotated/compare/v3.4.0...v4.0.0
ForeignKey attribute by @msmakouz in https://github.com/cycle/annotated/pull/91Now, you can easily define foreign keys in your entity classes using attributes, without needing any relation definitions.
Define Entities using the #[Entity] attribute. For example, a User entity can be created with an ID as the primary key.
use Cycle\Annotated\Annotation\Entity;
use Cycle\Annotated\Annotation\Column;
#[Entity]
class User
{
#[Column(type: 'primary')]
public int $id;
}
Set up Foreign Keys in two ways:
Directly on Properties: You can annotate a property in your class to indicate it's a foreign key related to another entity.
use Cycle\Annotated\Annotation\Entity;
use Cycle\Annotated\Annotation\ForeignKey;
#[Entity]
class Post
{
// ...
#[Column(type: 'integer')]
#[ForeignKey(target: User::class, action: 'CASCADE')]
private int $userId;
}
Or, on the Class Itself: Alternatively, you can place the foreign key annotation at the class level, specifying details like which property in your class is the foreign key (innerKey), and which property in the related class it corresponds to (outerKey).
use Cycle\Annotated\Annotation\Entity;
use Cycle\Annotated\Annotation\ForeignKey;
#[Entity]
#[ForeignKey(target: User::class, innerKey: 'userId', outerKey: 'id', action: 'CASCADE')]
class Post
{
// ...
#[Column(type: 'integer')]
private int $userId;
}
Full Changelog: https://github.com/cycle/annotated/compare/v3.3.1...v3.4.0
Full Changelog: https://github.com/cycle/annotated/compare/v3.3.0...v3.3.1
#[Column] expected values by @msmakouz in https://github.com/cycle/annotated/pull/70MergeColumns generator by @msmakouz in https://github.com/cycle/annotated/pull/72readonlySchema to the Column annotation by @msmakouz in https://github.com/cycle/annotated/pull/75Full Changelog: https://github.com/cycle/annotated/compare/v3.2.1...v3.3.0
smallInteger type hint to the Column attribute by @gam6itko in #52doctrine/annotations to version 2.0 by @msmakouz in #66Full Changelog: https://github.com/cycle/annotated/compare/v3.2.0...v3.2.1
Full Changelog: https://github.com/cycle/annotated/compare/v3.1.0...v3.2.0
morphKey default value by @roxblnfk in (#50)Full Changelog: https://github.com/cycle/annotated/compare/v3.0.0...v3.1.0
PrimaryKey class level annotation for composite pkeys by @rauanmayemir in https://github.com/cycle/annotated/pull/19though, add through annotation stubs by @rauanmayemir in https://github.com/cycle/annotated/pull/20Full Changelog: https://github.com/cycle/annotated/compare/v2.3.1...v3.0.0
scope parameter in the Entity attribute (#27)Upgrade composer PHP version
How can I help you explore Laravel packages today?