Weave Code
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

Laravel Resource Endpoints Laravel Package

spatie/laravel-resource-endpoints

Abandoned package that adds controller-based “links” and collection “meta” links to Laravel API Resources. Automatically generates URLs for actions like index/show/edit/update/delete, so resources can expose REST endpoints without manually building routes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • API Consistency & Developer Experience (DX):

    • Standardize API response structures by embedding actionable links (e.g., self, related, edit, delete) directly in Laravel API resources, reducing manual URL construction in controllers or frontend logic.
    • Align with HATEOAS principles to improve API discoverability and tooling support (e.g., Swagger/OpenAPI).
  • Roadmap: API-First Initiatives

    • Accelerate development of internal tools or public APIs by reducing boilerplate for link generation (e.g., self, related resources).
    • Enable faster iteration for microservices or modular architectures where endpoints may change frequently.
  • Build vs. Buy: Low-Risk, High-Impact

    • Buy: Avoid reinventing link-generation logic for CRUD APIs, especially if the team lacks bandwidth for custom solutions.
    • Build: Consider only if needing highly custom link logic (e.g., dynamic route parameters, complex relationships) or if maintaining the package long-term.
  • Use Cases:

    • Admin Panels/Dashboards: Embed action links (e.g., edit, delete) directly in API responses for SPAs or admin UIs.
    • Mobile Apps: Reduce frontend logic for navigating between related resources (e.g., user → orders).
    • Legacy API Refactoring: Retrofit existing APIs with consistent link structures without modifying controllers.

When to Consider This Package

  • Adopt If:

    • Your team uses Laravel API resources (JsonResource) and needs standardized, maintainable links for CRUD actions.
    • You prioritize developer velocity over customization (e.g., 80% of use cases fit standard link patterns).
    • Your API consumers (frontend/mobile) benefit from self-documenting endpoints (e.g., OpenAPI tools can auto-generate docs from links).
    • You’re okay with abandoned maintenance (last release: 2021) and can fork or replace it if needed.
  • Look Elsewhere If:

    • You need dynamic or non-standard links (e.g., links based on runtime conditions, non-CRUD actions).
    • Your team requires active maintenance (e.g., bug fixes, Laravel 10+ compatibility).
    • You’re building a public SDK where link consistency is critical (risk of breaking changes).
    • You prefer framework-agnostic solutions (e.g., manual URL generation or dedicated link services).
  • Alternatives to Evaluate:

    • Laravel’s Native Features: Use route() helpers or action() in resources (more control, but manual).
    • Custom Middleware/Traits: Build a lightweight in-house solution for complex needs.
    • Modern Packages: Explore spatie/laravel-api-resource (active) or nWink/laravel-routes for newer alternatives.

How to Pitch It (Stakeholders)

For Executives:

"This package lets us automate API link generation in Laravel, saving dev time and improving API consistency. For example, every User resource will include links to edit, delete, or related orders—no manual URL wiring needed. This reduces bugs, speeds up frontend integration, and aligns with modern API best practices like HATEOAS. The tradeoff? It’s abandoned, but the risk is low for our use case, and we can fork it if needed. Let’s pilot it for our [Admin Panel/API] to measure the impact on developer velocity."

For Engineering:

"This package adds HasLinks to Laravel API resources, embedding standardized links (e.g., self, edit) automatically. For example:

class UserResource extends JsonResource {
    use \Spatie\ResourceLinks\HasLinks;
    // ...
    public function toArray($request) {
        return [
            'name' => $this->name,
            'links' => $this->links(), // Auto-generates URLs like `/users/1/edit`
        ];
    }
}

Pros:

  • No more manual route('users.edit', $user) calls in resources.
  • Works out-of-the-box for CRUD; customize via config for edge cases.
  • Frontend/mobile teams get predictable links (e.g., for SPAs or OpenAPI tools).

Cons:

  • Abandoned (last update: 2021), but simple to fork if needed.
  • Not ideal for highly dynamic links (e.g., conditional routes).

Let’s test it in [Project X] to see if it cuts API dev time by 20%."

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport