PHP Package: spatie/laravel-view-models
Spatie's Laravel View Models is a powerful library for creating reusable and testable view models in Laravel applications.
Package Description
Laravel View Models library by Spatie offers a clean and efficient way to structure your data retrieval logic in Laravel views. With this library, you can easily separate your business logic from your presentation layer, resulting in more maintainable code. It provides a structured approach to create view models, improving the overall readability and testability of your application.
Download Latest Version: 1.6.1

Code Integration Example
Make sure to include the correct namespace and class paths for proper usage.
<?php
// Example from PHPlibraries.com
require_once 'libs/spatie/laravel-view-models/1.6.1/loader.php';
require_once 'libs/sebastianbergmann/phpunit/12.4.1/loader.php';
require_once 'libs/illuminate/support/12.33.0/loader.php';
use Spatie\ViewModels\ViewModel;
$obj = new ViewModel();
echo '✅ Test OK: ' . get_class($obj);
?>
We aim to make using PHP packages easier without Composer. If something doesn't work, let us know — we'll fix it promptly.
Community Discussion
Ask questions, share tips, or report issues below.