Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Annotated Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Schema generation using annotated entities and mappers

Frequently asked questions about Annotated
Can I use cycle/annotated with Laravel’s Eloquent models?
No, this package is designed exclusively for Cycle ORM, not Eloquent. If you’re using Eloquent, you’d need to migrate to Cycle ORM first or explore alternatives like Laravel’s built-in model annotations or packages like spatie/laravel-model-states.
What Laravel versions support cycle/annotated?
The package requires PHP 8.1+, which aligns with Laravel 9+ and later. For Laravel 8.x or older, you’ll need to upgrade PHP first, as Cycle ORM and this package depend on modern PHP features.
How do I migrate from Laravel migrations to cycle/annotated?
Replace your migration files with annotated entities in your models. Cycle ORM will generate the schema from your attributes during bootstrapping. Start with non-critical tables to test compatibility before full migration.
Does cycle/annotated support Laravel’s soft deletes or timestamps?
No, it doesn’t include Laravel-specific features like `SoftDeletes` or automatic timestamps. You’ll need to manually define these as columns or use custom annotations, though Cycle ORM supports generated fields for derived logic.
Will this work with Laravel Scout for search functionality?
Unclear—Scout relies on Eloquent models. You’d need to either rewrite Scout’s integration for Cycle ORM or use a separate search solution like Algolia or Meilisearch directly, bypassing Scout’s Laravel-specific features.
How do I handle complex relationships like ManyToMany in cycle/annotated?
Use the `HasMany` and `BelongsTo` annotations with a pivot entity. For example, define a `PostTag` entity with `BelongsTo` relations to both `Post` and `Tag`. Cycle ORM’s documentation covers pivot tables and polymorphic relations in detail.
Can I use cycle/annotated in a Laravel project without replacing Eloquent entirely?
No, this package requires Cycle ORM as the underlying ORM. You’d need to replace Eloquent’s `DatabaseServiceProvider` with Cycle ORM’s provider and update all queries to use Cycle’s query builder, which differs from Laravel’s syntax.
Are there performance benefits over Laravel’s migrations for schema changes?
Yes, schema changes are compiled at runtime from your annotated entities, reducing the need for migration files. However, Cycle ORM’s performance gains are most noticeable in complex queries, not schema generation itself.
How do I test models using cycle/annotated in Laravel’s testing environment?
Use PHPUnit or Pest directly with Cycle ORM’s testing utilities. Laravel’s built-in `create()` or `factory()` helpers won’t work—you’ll need to manually instantiate entities or use Cycle ORM’s repository pattern for testing data setup.
What’s the rollback plan if cycle/annotated doesn’t fit our Laravel project?
Revert to Laravel migrations and Eloquent by removing Cycle ORM’s service provider and restoring your original `DatabaseServiceProvider`. Ensure no critical logic depends on Cycle ORM’s query builder or schema generation before migration.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky