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

Add links to Laravel API resources

Frequently asked questions about Laravel Resource Endpoints
Is spatie/laravel-resource-endpoints compatible with Laravel 10+?
No, this package is abandoned and last updated in 2021, so it may not work with Laravel 10+ out of the box. You’d need to test it in a staging environment or fork it for compatibility. The package relies on older Laravel routing and resource structures that have evolved since then.
How do I add API links to a Laravel JsonResource?
Use the `HasLinks` trait in your `JsonResource` and call `$this->links(YourController::class)` in the `toArray()` method. For collections, use `self::collectionLinks(YourController::class)` in a static `meta()` method. The package auto-generates URLs for defined controller actions like `show`, `edit`, or `delete`.
Does this package support API versioning (e.g., /v1/users) or custom route prefixes?
The package relies on Laravel’s default route generation, so it may not handle custom prefixes (like `/v1/` or locale prefixes) automatically. If your API uses non-standard routes, you’ll need to manually adjust the generated links or extend the package’s logic.
What are the risks of using an abandoned Laravel package?
The main risks include no security patches for CVEs in dependencies, potential compatibility issues with newer Laravel/PHP versions, and lack of long-term support. If security or compliance is critical, consider alternatives like custom traits or actively maintained packages.
Can I use this package with Laravel Sanctum or Passport for authenticated API links?
Yes, the generated links will respect Laravel’s authentication middleware. However, since the package is abandoned, ensure your Sanctum/Passport setup works with the older Laravel versions it supports. Test thoroughly in a staging environment.
What’s the performance impact of adding links to every API response?
The performance impact is minimal—link generation adds negligible overhead to API responses. However, if you’re serving thousands of requests per second, consider caching responses or generating links only for specific endpoints.
Are there alternatives to spatie/laravel-resource-endpoints for HATEOAS in Laravel?
Yes, alternatives include manually constructing links with Laravel’s `route()` helper, using custom traits, or exploring newer packages like `spatie/laravel-api-tools` (if it supports HATEOAS). For GraphQL APIs, consider built-in relay-style links instead.
How do I test if this package works with my existing API resources?
Start by adding the `HasLinks` trait to a non-critical resource (e.g., `UserResource`) and compare the generated links against manually constructed URLs. Use Laravel’s `route()` helper to verify correctness. Test edge cases like nested resources or dynamic route parameters.
Will this package work with Laravel’s route caching (`php artisan route:cache`)?
Route caching may cause issues since the package was last updated before Laravel 10’s route service provider changes. Test caching in a staging environment—if links break, you’ll need to disable caching or modify the package to support the new structure.
How do I contribute or fork this package for Laravel 10+ support?
Fork the repository on GitHub and update dependencies (e.g., `spatie/laravel-package-tools`) to their latest versions. Test with Laravel 10’s route model binding and `JsonResource` changes. Submit a pull request to the original repo if the maintainer is responsive, or publish your fork as a standalone package.
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