Weave 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
Laravel Schema Macros

Laravel Schema Macros Laravel Package

envor/laravel-schema-macros

A Laravel package that extends the Schema/Blueprint builder with handy macros for defining common database table columns and constraints, reducing boilerplate in migrations and keeping schema definitions concise.

View on GitHub
Deep Wiki
Context7

Some helpful (database level) macros for laravel's schema builder. Requires Laravel 11.

Frequently asked questions about Laravel Schema Macros
What does envor/laravel-schema-macros do?
It is a Laravel package that extends the Schema and Blueprint builders with macros for defining common database table columns and constraints. The goal is to reduce repetitive boilerplate in migration files and keep schema definitions short and readable. It is a migration-time developer convenience, not a runtime service or infrastructure component, so its architectural footprint is minimal. It requires Laravel 11 and is installed through Composer.
How do I install envor/laravel-schema-macros in a Laravel 11 app?
Install it with Composer using composer require envor/laravel-schema-macros, then confirm the service provider is registered if your application does not rely on package auto-discovery. Follow the package documentation for any publish or configuration step before using the macros in migrations. Try it first in a branch or staging environment rather than adding it alongside a high-risk production migration. Once validated, pin the version you have tested.
Which Laravel and PHP versions does this package support?
The package explicitly targets Laravel 11, so treat Laravel 11 as the supported baseline. Check the composer.json of the release you intend to use for the exact PHP constraint and any other dependency requirements. If your application runs an older or newer Laravel major version, verify compatibility before adopting it. Pinning the package version initially avoids surprises from upstream changes.
What does the copy macro added in v1.1.6 actually do?
The v1.1.6 release adds a copy macro, but the available release notes do not clearly define whether it copies column definitions, data, indexes, or database-specific schema constructs. Review the package source and tests for the macro to confirm its exact API and behavior before relying on it. Test it against representative schemas in staging and watch for data movement, table locks, or engine-specific SQL. Until those semantics are confirmed internally, treat copy as the highest-risk part of the package.
Does it work with MySQL, PostgreSQL, and SQLite?
Because the macros operate at the database schema level, behavior can vary by engine, so do not assume identical results across MySQL, PostgreSQL, and SQLite. Test the specific macros you plan to use against the database engine you run in production, especially the copy macro. If a macro emits engine-specific SQL, keep a native Laravel schema fallback for databases that are not verified. Document which macros are approved per engine for your team.
Is it safe to use in production migrations?
It is generally low risk for simple column and constraint macros, but the copy macro raises the risk profile until its behavior is verified. Pilot the package in a non-production branch, write up and down migration tests, and avoid combining initial adoption with large-table or high-traffic migrations. Review lock duration and rollback strategy if a macro touches data or large tables. Pin the version and canary one low-risk migration before standardizing usage.
Could these macros collide with existing Blueprint or schema methods?
Macro registration conflicts are a plausible failure mode, particularly if your application or another package already defines a macro with the same name. Before adopting, list the macro names the package registers and compare them with your own custom macros and any schema-related packages in the project. Run your migration suite after installing to catch collisions early. If a conflict exists, resolve it in staging rather than discovering it during a deployment.
How should I test migrations that use schema macros?
Write explicit migration tests covering both the up and down paths, and run them against the same database engine you use in production. Use your normal test harness to run migrations from a clean database so the macros are exercised along with native schema calls. For the copy macro, add cases with representative column types, indexes, and constraints, and check rollback behavior explicitly. Keep these tests in the repository so future package upgrades are validated automatically.
Does the Dependabot fetch-metadata update affect my application?
No. The Dependabot bump to dependabot/fetch-metadata affects the repository's GitHub Actions metadata automation, not the package runtime behavior. Your application will not see a behavioral change from that update. The meaningful functional change in v1.1.6 for application developers is the new copy macro, which is the part that needs validation. You can upgrade for the metadata change without expecting runtime differences.
What are the alternatives if the package is unmaintained or undocumented?
You can register your own Blueprint and Schema macros in a service provider, which covers most of the same boilerplate reduction without an external dependency. For advanced schema introspection and management outside migrations, dedicated schema packages exist, but they are a different scope. Native Laravel schema methods remain the safest fallback for anything the macros do not clearly document. Keeping an internal fallback path means an unmaintained package never blocks a release.
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.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource