tobya/anymodel
Larablocks Analysis
tobya/anymodel works with any PHP project: the latest release (v1.10, Nov 9, 2026) doesn't depend on Laravel.
Recommendation checks
PromisingPromising: 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 |
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
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | License |
|---|---|---|
| v1.10 | MIT | |
| v1.9 | MIT | |
| v1.8 | MIT | |
| V1.7 | MIT | |
| V1.6 | MIT | |
| V1.5.1 | MIT | |
| v1.5 | MIT | |
| v1.4 | MIT | |
| v1.3 | MIT | |
| V1.2 | MIT | |
| 1.1 | MIT | |
| V1.0 | MIT |