Can somebody tell me few words about apigility ( https://github.com/zfcampus/zf-apigility ) ? Can I use it with zf3 with my current zend-mvc project (or with ZendSkeletonApplication ( https://github.com/zendframework/ZendSkeletonApplication ) )? Is it required to use admin UI panel (zf-apigility-admin-ui) ? Is it still relevant to use it in 2019?
Within admin panel of my project I want to do some actions with user data: create, list, update, delete with vuejs. All this actions will be executed via ajax. Also, I want to do such actions with another entities (news, articles, blog posts etc.). Is it the best choice to use apigility for these tasks?
I’ve been using Apigility successfully for a few years for one project, and it still give me satisfaction to this day. The admin UI is a nice way to configure things quickly.
However as the project grew I realised a few shortcomings for our case. First we’ll probably never need to version our API, because it is not meant to be used by third parties. We also never really used the documentation feature, because our team is small and the API rather straightforward.
But the most annoying thing of all is the huge configuration file generated by the admin ui. Because the admin ui does not expose everything you will have to manually edit that file and that can quickly become a bit overwhelming.
Also things can get a bit repetitive, eg when adding DateTime fields I have to configure how every single one how they will be serialized. I would rather be able to declare “all DateTime types will be serialized that way”.
Still I don’t regret the choice of Apigility.
That being said for new project I moved from REST to GraphQL. So Apigility can’t help you for that. And I would recommend seriously considering GraphQL for your use case.
Thank you for such detailed reply. Can GraphQL be integrated into zf3 project? How long do you use GraphQL?
Also, I want to use doctrine.
You can use Doctrine with ZF3 and Apigility. I do it in several projects and I don’t regret the switch from Zend-DB to Doctrine.
Pagination for REST is a bit tricky but after you figure out how to set it up, it’s as simple as everything else.
Do you use zfcampus/zf-apigility-doctrine ?
No, I use doctrine/orm and doctrine/doctrine-orm-module, since by the time i starting reading about zf-apigility-doctrine it was sort of to late to integrate it
I see. How can I use apigility for ajax call within admin panel? It would be great to use session for authorization but session will break stateless of REST. What should I do? I am little confused because oAUTH2 isn’t for such purposes, right?
In case of authorization, I created my own solution which uses a unique token (UUID) in the HTTP Header (Authorization) which are stored in a table. The verification is triggered within “onBootstrap()” out of the Module.php. Storing it in a table has a couple advantages on my end. I can see who is active (logged in), it is used for session timeout and I can disable access right there.
I’ve been using ZF (1 and 3), with Doctrine, graphql-php and ecodev/graphql-doctrine with success in 4 projects (1 huge, 3 small/medium).
I wrote ecodev/graphql-doctrine. It might fit your need, but nowadays there are other alternatives too. So you should research them and make your own choice.
When using ZF3 we don’t use MVC but ZF Expressive instead. It’s working well, but if you’re stuck with MVC, I’m sure your can make it work too.
If you choose GraphQL instead of REST, then you should consider using apollo on the client side.
You can see a real world project implementing all of that in https://github.com/ecodev/my-ichtus.
Can you tell me should I use zf-apigility-doctrine? I don’t understand how to use it and what benefits I will get by using it. I have created new topic What benefits could I get if I used zfcampus/zf-apigility-doctrine within apaigility? . Can you give me a short answer there?
For authorization use OAuth2. I wrote a client for zf-oauth2 which is quite popular and made with Doctrine 2: https://github.com/API-Skeletons/zf-oauth2-doctrine
You can use this OAuth2 library to authenticate GraphQL endpoints too. I’ve created a GraphQL for Doctrine which reads the Doctrine metadata and creates all the types and filters for you: https://github.com/API-Skeletons/zf-doctrine-graphql
Look at https://github.com/API-Skeletons/zf-oauth2-doctrine-permissions-acl too
For each of these libraries I’ve created dozens of documentation pages.
I’ve used the documentation extensively. Here is my result: https://api.etreedb.org/apigility/documentation/DbApi-v1
HI, Guido! Can you help me with doctrine integration with apigiliti without zf-apigility-doctrine? I have created new topic Empty collection arrays from doctrine within apigility fetchAll($params) resource method . I have some issue.