Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Exposable Model - Package to ease in the exposing of model properties on an API
FuelPHP package to ease in exposing model properties on your API. This package supplies you with an extension of Fuel's default Orm\Model: Exposable\Model. Exposable Model provides your model with additional functionality for exposing certain model properties on an API. I recently built a RESTful API atop Fuel and found specifying fields to expose via the API to be painful, so wrote a few helper methods to allow each resource to specify exactly which fields to expose, along with the ability to expose computed/dynamic fields. More details on the Github page:
Pretty cool, nice idea! I solved the same problem (of not wanting to expose, say, 'password' from the User model), but chose the route of explicitly defining this in some sort of a view file, using
the representation package
I wrote. Advantages to going this way is that it's easier to expose different fields to different API's and also add other data. Especially with RESTful resources, at some points you'll be adding links and I don't like to have those in my Models as they might be used in a context where you don't work with URI's (oil is a good example). It also makes me feel I have better control of what the API is actually exposing because it's all declared explicitly.
Exactly what I was looking for! Great work.
For the record, I think this is a really cool package. Thanks for sharing.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion