Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Resources Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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:

  1. Confirm the runtime ceiling. You need Laravel 5.2 and the matching PHP range (roughly PHP 5.6–7.0). If the app is on Laravel 5.3+, stop — the illuminate/* constraints conflict and there is no forward-compatible path.
  2. Require only if already in the app or lock file. Prefer an exact pin and commit composer.lock:
    composer require orchestra/resources:~3.2
    
  3. Register the service provider manually in 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.
  4. Register the facade alias with the new namespace:
    'aliases' => [
        // ...
        'Resources' => Orchestra\Resources\Facade::class,
    ],
    
    Remove Orchestra\Support\Facades\Resources — it is scheduled for removal.
  5. Publish config if shipped:
    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.
  • Package release notes — confirm the deprecation notice and the facade rename.

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.

Implementation Patterns

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.

Gotchas and Tips

  • Deprecation is the primary constraint. Do not build new features on this package. New functionality goes through the adapter, or better, through native Laravel code the adapter can later delegate to.
  • Laravel 5.2 is a hard ceiling. The ~5.2 constraint conflicts with Laravel 5.3+ and modern illuminate/* components. Do not attempt to install it on a current Laravel app.
  • The facade alias is a scheduled break. Orchestra\Support\Facades\Resources will be removed. Migrate every import and config/app.php alias to Orchestra\Resources\Facade now.
  • No auto-discovery. On Laravel 5.2 you must register the provider and alias manually. If the facade is "not found," check config/app.php first.
  • Provider order matters. Resource registration must run before routes/controllers resolve resources. Register in boot() and verify the provider runs after the package provider.
  • Clear caches after alias/config changes. Run php artisan config:clear and composer dump-autoload whenever you change facades, aliases, or provider registration.
  • Avoid alias name collisions. A global Resources alias can collide with application classes. Consider using the fully qualified facade inside the adapter only and not exposing the alias elsewhere.
  • Debug resolution failures with the container. Check app()->bound(...), inspect the concrete class behind the facade, and log inside the registration callback to confirm it actually runs.
  • Pin and mirror. Pin the exact version, commit composer.lock, and stand up a private Composer mirror/satis so upstream removal cannot break builds.
  • Capture knowledge before it walks out. The package is deprecated and Orchestra-specific conventions are poorly documented; record how resources are registered and resolved while someone still knows.
  • Do not let the dependency spread. The most common failure mode is convenience-driven scope creep — because the facade is easy to call, it ends up in controllers, views, and jobs. Keep it behind the adapter and shrink the surface over time.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib