Download the PHP package amol/laravel-jsonsafe without Composer
On this page you can find all versions of the php package amol/laravel-jsonsafe. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download amol/laravel-jsonsafe
More information about amol/laravel-jsonsafe
Files in amol/laravel-jsonsafe
Download amol/laravel-jsonsafe
More information about amol/laravel-jsonsafe
Files in amol/laravel-jsonsafe
Vendor amol
Package laravel-jsonsafe
Short Description Mutable JSON column casting for Laravel Eloquent
License MIT
Homepage https://github.com/AmolKumarGupta/laravel-jsonsafe
Package laravel-jsonsafe
Short Description Mutable JSON column casting for Laravel Eloquent
License MIT
Homepage https://github.com/AmolKumarGupta/laravel-jsonsafe
Please rate this library. Is it a good library?
Informations about the package laravel-jsonsafe
laravel-jsonsafe
[](https://packagist.org/packages/amol/laravel-jsonsafe) [](https://github.com/AmolKumarGupta/laravel-jsonsafe/actions/workflows/run-tests-push.yml) Mutable JSON column casting for Laravel Eloquent. Supports JSON Schema validation via `opis/json-schema`. ## Installation You can install the package via composer: ## Usage ### Basic casting Cast a JSON column to `JsonSafe` in your model: Read and write nested keys directly — changes persist on `save()`: ### JSON Schema validation Define a public `schemaOf{Key}()` method on your model to enable validation. The column key is converted to StudlyCase and prefixed with `schemaOf` (e.g., `preferences` → `schemaOfPreferences()`). If the data violates the schema, an `Exception` is thrown before the database write: Key mapping rules: - `preferences` → `schemaOfPreferences()` - `my_column` → `schemaOfMyColumn()` - `UPPERCASE` → `schemaOfUppercase()` Columns without a schema method are not validated. Schemas follow the [JSON Schema](https://opis.io/json-schema/2.x/structure.html) standard via `opis/json-schema`. You can use any supported keywords (`type`, `properties`, `enum`, `required`, `minimum`, `maximum`, `pattern`, etc.). ### Serialization `toArray()` and `toJson()` return the underlying plain array: ## Testing ## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. ## Contributing Please see [CONTRIBUTING](CONTRIBUTING.md) for details. ## Security Vulnerabilities Please review [our security policy](../../security/policy) on how to report security vulnerabilities. ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
All versions of laravel-jsonsafe with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.3
illuminate/contracts Version ^11.0||^12.0||^13.0
opis/json-schema Version ^2.6
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0
opis/json-schema Version ^2.6
spatie/laravel-package-tools Version ^1.16
The package amol/laravel-jsonsafe contains the following files
Loading the files please wait ...