orchestra/resources
Resources component for Orchestra Platform, giving Laravel applications a consistent API to register, load, and publish package resources such as views, translations, configuration files, and migrations.
This package is deprecated and pinned to Laravel ~5.2. "Getting started" means safely maintaining an existing install, not evaluating it for new work.
Minimum steps for a legacy Laravel 5.2 app:
illuminate/* constraints conflict and there is no forward-compatible path.composer.lock:
composer require orchestra/resources:~3.2
config/app.php (no auto-discovery in 5.2):
'providers' => [
// ...
Orchestra\Resources\ResourcesServiceProvider::class,
],
Check vendor/orchestra/resources/src for the exact provider class name if it differs.'aliases' => [
// ...
'Resources' => Orchestra\Resources\Facade::class,
],
Remove Orchestra\Support\Facades\Resources — it is scheduled for removal.php artisan vendor:publish --provider="Orchestra\Resources\ResourcesServiceProvider"
Where to look first:
vendor/orchestra/resources/composer.json — constraints, version, provider hints.vendor/orchestra/resources/src/ — the resource factory/facade and base resource classes.config/app.php — provider and alias registration.First use case — put a boundary around the facade before anything else. The exact method names come from the package's factory class; the adapter below is the only place that should know them.
namespace App\Resources;
use Orchestra\Resources\Facade as ResourcesFacade;
class ResourceRegistry
{
public function register($name, $resolver)
{
ResourcesFacade::register($name, $resolver);
}
public function resolve($name)
{
return ResourcesFacade::get($name);
}
}
Inject ResourceRegistry wherever resources are needed instead of calling the facade directly.
Use a thin adapter as the daily boundary. Every direct facade call becomes migration debt. Wrap registration and resolution in one application class and depend on that class in controllers, commands, and views. When you replace the package, you change one class instead of every call site.
Register resources in a dedicated service provider. Keep resource registration out of AppServiceProvider so the dependency is visible and removable:
namespace App\Providers;
use App\Resources\ResourceRegistry;
use Illuminate\Support\ServiceProvider;
class ResourceServiceProvider extends ServiceProvider
{
public function boot(ResourceRegistry $registry)
{
$registry->register('reports', function () {
return new \App\Resources\ReportResource();
});
}
}
Resolve resources in controllers, not views. Inject the registry and resolve the resource for the action:
namespace App\Http\Controllers;
use App\Resources\ResourceRegistry;
class ReportController extends Controller
{
protected $resources;
public function __construct(ResourceRegistry $resources)
{
$this->resources = $resources;
}
public function show($id)
{
$report = $this->resources->resolve('reports')->find($id);
return view('reports.show', compact('report'));
}
}
Expose CRUD workflows through Laravel's resourceful routing. The package's value is the registry/resolution layer, not a reason to invent custom routing. Use normal routes and let the controller resolve the resource:
Route::resource('reports', 'ReportController');
Prefer composition over subclassing base classes. The package advertises extensible base resource classes, but in a deprecated dependency composition is safer: implement a small application-level resource class and register a resolver for it. Subclassing welds you to internals that will never receive fixes.
Keep the facade out of Blade templates. Pass resolved data into views. A facade call in a view is invisible to dependency analysis and makes the eventual migration harder.
Test through the adapter. Bind a fake ResourceRegistry in tests instead of hitting the package facade, so tests stay stable when the package is removed.
Plan the replacement in the adapter itself. It can initially delegate to Orchestra\Resources; later swap its internals to native Laravel resource controllers, route model binding, and container bindings without touching application code.
~5.2 constraint conflicts with Laravel 5.3+ and modern illuminate/* components. Do not attempt to install it on a current Laravel app.Orchestra\Support\Facades\Resources will be removed. Migrate every import and config/app.php alias to Orchestra\Resources\Facade now.config/app.php first.boot() and verify the provider runs after the package provider.php artisan config:clear and composer dump-autoload whenever you change facades, aliases, or provider registration.Resources alias can collide with application classes. Consider using the fully qualified facade inside the adapter only and not exposing the alias elsewhere.app()->bound(...), inspect the concrete class behind the facade, and log inside the registration callback to confirm it actually runs.composer.lock, and stand up a private Composer mirror/satis so upstream removal cannot break builds.How can I help you explore Laravel packages today?