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.
API Consistency & Developer Experience (DX):
self, related, edit, delete) directly in Laravel API resources, reducing manual URL construction in controllers or frontend logic.Roadmap: API-First Initiatives
self, related resources).Build vs. Buy: Low-Risk, High-Impact
Use Cases:
edit, delete) directly in API responses for SPAs or admin UIs.user → orders).Adopt If:
JsonResource) and needs standardized, maintainable links for CRUD actions.Look Elsewhere If:
Alternatives to Evaluate:
route() helpers or action() in resources (more control, but manual)."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."
"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:
route('users.edit', $user) calls in resources.Cons:
Let’s test it in [Project X] to see if it cuts API dev time by 20%."
How can I help you explore Laravel packages today?