-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Hey there,
API-Platform is an ecosystem full of features and tools, but its documentation is growing fast, and it begins to lack of an appropriate structure to keep things tidy and clear.
I have identified several drawbacks on the current documentation that could lead astray newcomers:
-
The Api Component sublevels are far too many, and don't share the same level of importance (i.e NelmioApiDocBundle being sibling of Operations, for instance)
-
Starting by the Distribution makes look like Api-Platform can't work without a proper Docker setup and all the things (mercure, h2 push, varnish, let's encrypt, postgresql, ...), which isn't true.
With the advent of Flex, everything is done in Symfony to make applications from simple to advanced: you onlycomposer req
the components you need.
Beside, if we can assume the user has a minimal knowledge of Symfony (it is used under the hood along with Doctrine, share the same concepts, components and structure), Api-Platform can work without Docker, so we shouldn't add Docker into the learning curve if it's not mandatory.
As a consequence, I think the distribution should not be the very starting point, but exposed as a great tool to get a full-featured environment.
The starting point could be a simplecomposer req api && bin/console server:start
, to focus on the API itself instead of its environment.
In the meantime, example commands should not be prefixed bydocker-compose exec
. -
Similarly, some components (schema generator, client generator, ...) are useful tools but may not deserve a top-level position in the documentation hierarchy (generators being useful doesn't mean they are necessary). It make them look like they're completely part of Api-Platform and you can't work without them, which is wrong. At least it makes you focus on the stack instead of the core.
They could be grouped in a sub level and/or expanded in a separate documentation. -
Some topics cover easy setup as well as advanced coding and configuration. While this might be a good idea at first glance, most of the time it leads to extremely scrollable pages and things the user doesn't want to read at this moment. It also makes the information hard to find when you're looking for something. Hacks and tricks should be moved away in a specific section, in my opinion (and linked from the main topics they're related to).
-
The documentation sections hierarchy should target newcomers at first, and go to experienced users at the end.
-
An F.A.Q. or How do I? section is really missing. Having such a section could also lead some developers to share their own recipes and help the community.
Read -> Install -> Configure -> Play -> Code -> Test -> Deploy -> Tune -> Hack
After thinking about this, I suggest the following key topics to drive the user from basics to advanced:
API-Platform
-
Introduction
State of the art, philosophy, features
-
Installation
On an existing project / new project / docker distribution
-
Usage and configuration
Schema generator, entity map, serialization, events, ...
-
Pagination, filters and sorting
You can start to play with your data
-
Security
JWT, FOSUserBundle, ACLs
-
Exposing your API
Versioning, deprecations, sunset, error messages, ...
-
Consuming your API
OpenAPI/Swagger export, GraphQL support, Client generators
-
The Admin Component
Big topic that should be kept handled apart
-
Testing
Fixtures, writing functional tests
-
Deployment
Kubernetes, Heroku, Platform.sh, ...
-
Caching & performance optimization
Cache invalidation, custom headers, Doctrine tips, PHP-PM, Blackfire
-
Advanced Usage
Custom operations/controllers, DTOs, custom filters, data providers/persisters, CQRS, ...
-
How do I?
Enable MongoDB, ElasticSearch, NelmioApiDocBundle, Mercure, file uploads, ...
-
Troubleshooting
Docker issues, Nginx issues, JMS serializer issues, links to SF Slack / Stackoverflow
A more detailed reorganization is available on this gist.
What do you think?
Sorry for the long post! 😅