Open nasyrov opened 7 years ago
Hey!
Yes, I've been looking into the 5.5 resources and feel they're a step in the right direction, however, they currently don't provide the same feature-set as Fractal. The only really unique feature of the 5.5 resources is the conditional attributes and I will be looking into supporting this in the near future.
I've been tinkering with ways to combine them to get the best of both worlds, but they don't really play well together and it would probably be more efficient to just use the 5.5 resources and rewrite some of Fractal's features on top of it. However, I feel like this package is in a really good state after a recent major rewrite and I'm thinking I'm gonna give the 5.5 resources some time to adopt before I head into a new rewrite.
One crazy idea that just crossed my mind though; I suppose I could rename Transformer to Resource and move it into the Http folder for a 3.0
release to make it feel more like 5.5. But the 'resource' name do kind of collides with Fractal's own concept of a resource..
Sounds reasonable! Let it steep for some time... The one thing I'm afraid of is that you can keep up with the laravel features like conditional fields but I'm pretty sure there will be more features introduced with time and you will have to basically duplicate the code...
I'll leave this issue open and think some more about how to best support resource objects.
Hi @flugger,
Is there any update on this? It would be awesome to make use of eloquent resource functions.
I'm currently building a laravel application where I'm using eloquent resources, in an effort to learn more about them and see how they would fit into this package. So I'm definitely keen on finding a solution for this, but I'm afraid it requires a major rewrite. I'll keep you updated :)
@nasyrov @mrajabtech I have some updates I would like to share - the last couple of weeks I've been hard at work rewriting the package to support API resources and discard Fractal altogether. This has allowed me to simplify the code a lot and I believe the package has a clearer focus and is easier to use while keeping the core of the package the same. Most of the open issues will be solved with this release. If anyone has any requests for the new version, please let me know. I expect to have it all ready before 2020 🙂
@flugger Fantastic!! Can't wait to play with the new release :100:
Hi @flugger sounds exciting!
Hi @flugger, do you think we are close to see the eloquent resources switch?
I see there is a branch feature/api-resources
, is it stable enough to use it in my application?
@iamroi Hi, we are close indeed! Things have slowed down a bit the past month, but I'll put some effort into finishing the version soon :)
I don't think the branch is stable enough to use in production yet, but would love some feedback, so feel free to use it and tell me what you think. It's a complete rewrite of the package and I've been a bit hesitant to release it as I want to make sure people will be happy with the changes.
Hey @flugger great looking package - thanks! I've been looking for something that incorporates Laravel resources.
I've just tried to install what will be v4.0 but i'm getting a class not found error for Flugg\Responder\Http\Responses\Decorators\StatusCodeDecorator
Output
Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 0 removals
PHP Fatal error: Uncaught Error: Class 'Flugg\Responder\Http\Responses\Decorators\StatusCodeDecorator' not found in /home/aubrey/development/concord/vendor/flugger/laravel-responder/src/ResponderServiceProvider.php:66 Stack trace:
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Hey @iamroi and @aubreychiduku , sorry for the delay on the new version and the problems in the "alpha" version - have been some busy months and want to get it perfect before I release it. Have had quite some time to work on it the couple past weeks and I must say, the end result is looking better than first anticipated. I'm very happy with the direction the package is heading and it should be ready for release sometime soon. I'll see if I can push the latest changes once I hit the next milestone and the tests pass.
With that said, I'd love to share some of the highlights of the new version:
SimpleFormatter
, which looks very similiar to the default serializer today, and a JsonApiFormatter
. I know a lot of people use Fractal to work with JSON API and I don't want to leave them in the dark with the new version. One difference between Fractal's serializers and formatters is that formatters also defines a format for error responses. It's also much easier to build your own formatters than it is to build Fractal serializers. (You only have two methods: success
and error
to format each response respectively).Normalizer
, which normalizes a type to an understandable format. The normalizers are configurable, meaning you can easily extend the package to accept new type of data structures.And all of this with the same API as before and a 40% reduction of code allowing for a more concise code base. It also currently has 100% test coverage. Hope you're all as excited as I am!
Omg this is soo exciting!! Thank you for finding time to work on this in your busy schedule. I can't wait to try the new features :) Hope I can contribute in some way!
Hello!
Found this "issue" and wondering is the new version still alive? :)
Hi @Hesesses,
I've been eagerly awaiting its release for quite some time. However, since I'm not actively using PHP in my day-to-day work, finding the time and motivation to complete the final steps has been challenging. The package is almost finished, and to the best of my knowledge, it should work flawlessly. You can find the code and updated documentation in the api-resources branch. To be transparent, here's the remaining to-do list that I haven't touched in a year or two:
As you can see, the project is nearly complete. However, since it has been a while since I delved into the code, it will take some time to familiarize myself with it again. My plan is to run the new version on a fresh Laravel installation and thoroughly test that everything functions as intended. I welcome any contributions from the community, and I'll make an effort to allocate time soon to address the remaining tasks.
Thanks @flugg for the update.
I'm planning to start a new project in few weeks and I will give a try for the new version. I have never been working with a package, but I will test as much as possible and give feedback 🙏
Do you have any ideas why installing the branch does not work with composer?
composer.json
"flugg/laravel-responder":"dev-feature/api-resources",
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/flugg/laravel-responder"
}
]
Your requirements could not be resolved to an installable set of packages.
Problem 1
Hi @flugger,
Have you seen https://laravel.com/docs/5.5/eloquent-resources? If so, would you consider to release a new package version that leverages that new feature?
Cheers, Evgenii