PHPackages                             zablockibros/laravel-schemaless - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zablockibros/laravel-schemaless

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zablockibros/laravel-schemaless
===============================

Make models with no schema

00PHP

Since Mar 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/zablockibros/laravel-schemaless)[ Packagist](https://packagist.org/packages/zablockibros/laravel-schemaless)[ RSS](/packages/zablockibros-laravel-schemaless/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Schemaless
==================

[](#laravel-schemaless)

Create and prototype with models without needing to create migrations and alterations to a database schema.

Why?
----

[](#why)

When quickly prototyping an API or web app, you will be constantly adding and altering table columns and relationships to your model. With Schemaless, you can simply create models and extend the `ZablockiBros\Models\Item` model and define `$extraAttributes`. Create records, set attributes, fill records all the ways you normally would in Laravel.

Installation
------------

[](#installation)

**Requirements**: This package requires PHP 7.1.3 or higher and Laravel 5.7

1. Install the package via Composer:

    ```
    $ composer require zablockibros/laravel-schemaless
    ```

    The package will automatically register its service provider.
2. Publish the package:

    ```
    php artisan vendor:publish --provider="ZablockiBros\Schemaless\SchemalessServiceProvider"
    ```
3. Run migrations:

    ```
    php artisan migrate
    ```

Configuring Your Models
-----------------------

[](#configuring-your-models)

You can use schemaless attributes and relationships using your own tables or the migration-provided `items` tables and the base `Item` model class.

### Using Item Base Model

[](#using-item-base-model)

1. Create your model:

    ```
    php artisan make:model Models/YourModel
    ```
2. Extend the `ZablockiBros\Models\Item` class:

    ```
    class YourModel extends \ZablockiBros\Models\Item
    ```
3. Define your schemaless attributes:

    ```
