New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

tobya/anymodel

Allows creation of a Laravel Entity Model for an arbitrary table
4,489

Larablocks Analysis

tobya/anymodel works with any PHP project: the latest release (v1.10, Nov 9, 2026) doesn't depend on Laravel.

Promising: maintained and up to date, meets 1 of 3 checks; not yet widely used.

  • Released in the last 12 months (Nov 9, 2026)
  • 44 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Maintained
  • Last stable release: Nov 9, 2026.
  • 2 releases in the last 12 months.
  • First released: Apr 28, 2022.
  • Monthly downloads: 44.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require tobya/anymodel
Latest Version:v1.10
License:MIT
Last Updated:Nov 9, 2026
Links: GitHub  ·  Packagist
Maintainer: tobya

AnyModel

Allows creation of a Laravel Entity Model for an arbitrary table or view

Allow creation of Laravel Entity Model for any arbitrary table without needing to declare a Model first.

This is particuarily useful if you have a legacy application that uses Views and you do not wish to create a model for each view.


    // return a new model built from vw_ConfirmedBookings table/view
    $Bookings =  AnyModel::table('vw_ConfirmedBookings')
                                  ->where('Confirmed',true)                                  
                                  ->orderBy('updated_at')
                                  ->get();

    // Work with model in normal way
    $Bookings->each(function($Booking){
        AddName( $Booking->name);
    });

Installation

 composer require tobya/anymodel

Concerns

Anymodel package comes with some concerns

use HasNoTable;

use BasedonView;

HasNoTable should be used for a model where you do not wish for a save to be possible. This is useful for Views. BasedonView is an alias for HasNoTable.

use HasCustomPrimaryKey;

Some older tables do not use id as the primary key and the new primary key can be set on the model. However if you call $model->id in your code you will get a null rather than the correct value or an exception. This will correctly return the primaryKey value when $model->id is requested.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released License
v1.10 MIT
v1.9 MIT
v1.8 MIT
V1.7 MIT
V1.6 MIT