- How do I install fisharebest/laravel-floats in a Laravel application?
- Install it with Composer using composer require fisharebest/laravel-floats. The package is intended for Laravel and likely uses package auto-discovery, so manual service provider registration is normally unnecessary. Before adopting it, confirm its composer.json constraints match your Laravel, PHP, and MySQL versions.
- Does Laravel already support FLOAT columns natively?
- Yes, Laravel's Blueprint exposes float and double column types in many versions, so this package is not required for every FLOAT use case. Its value depends on whether it generates exact MySQL FLOAT DDL or fills a version-specific schema gap. Compare its output with $table->float() and raw SQL before adding a dependency.
- Which Laravel, PHP, and MySQL versions does fisharebest/laravel-floats support?
- The provided overview does not list an explicit support matrix, so check the repository's composer.json and README for Laravel, PHP, and MySQL constraints. Validate those constraints against your current Laravel major version and the MySQL 5.7 or 8.0 variants you use in CI and production. Treat any undocumented version support as a risk to verify with a migration spike.
- What MySQL DDL does fisharebest/laravel-floats generate for migrations?
- The package is described as letting Laravel migrations create FLOAT columns in MySQL. Confirm the exact DDL by running a test migration and inspecting SHOW CREATE TABLE. Compare that output with native Blueprint float or double columns and DB::statement raw SQL before deciding the package is necessary.
- How do I use the Eloquent cast and helpers for float attributes?
- The package provides an Eloquent cast and helpers for storing, retrieving, and comparing floats without locale issues. Use the cast in your model's $casts array as documented in the README, and apply the helpers where you need consistent float comparisons. Test round-tripping values against your database to confirm precision behavior.
- Are MySQL FLOAT columns safe for money or exact decimal values?
- MySQL FLOAT is an approximate numeric type, so it can produce rounding differences that DECIMAL avoids. This package helps with migration DDL and float casting or comparison helpers but does not change MySQL's underlying FLOAT semantics. Use DECIMAL for monetary or exact decimal values, and confirm FLOAT is semantically correct for your data.
- Is fisharebest/laravel-floats safe to use in production?
- It is MIT licensed and affects migrations rather than the request path, which limits legal and runtime exposure. The main production concern is dependency quality: very low adoption, likely a single maintainer, and an unclear support matrix. Pin the version, test migrations and rollbacks in CI, and document a fallback to native Blueprint methods or raw DDL.
- How do I test migrations and rollbacks with this Laravel float package?
- Add a test migration using the package and run php artisan migrate and php artisan migrate:rollback in a disposable MySQL database. Inspect the resulting schema with SHOW CREATE TABLE and confirm rollback removes the column as expected. Also test schema dumps and repeated CI migration runs to catch incompatibilities with native Laravel schema APIs.
- Can I remove fisharebest/laravel-floats later and use native Laravel columns?
- Because the package is a migration-time helper, removal is relatively straightforward once existing migrations are rewritten or frozen. Replace package-specific calls with native $table->float() or double() methods or DB::statement raw DDL, then verify the schema matches. Keep the dependency pinned and document why it exists so future teams know when native support is sufficient.
- Does fisharebest/laravel-floats conflict with native Blueprint macros or other schema packages?
- The overview does not describe its integration mechanism, so conflicts with native Blueprint macros or other schema packages should be tested rather than assumed. Run a spike with your existing migration macros and schema tooling to confirm the package does not override or collide with them. If it relies on deprecated Laravel schema APIs, prefer native methods or raw DDL.