Upgrade to Pro — share decks privately, control downloads, hide ads and more …

REX API Platform

REX API Platform

Talk given at PHPTour Nantes 2017
Joindin: https://joind.in/event/php-tour-2017-nantes-/rex-api-platform

Olivier Dolbeau

May 19, 2017
Tweet

More Decks by Olivier Dolbeau

Other Decks in Programming

Transcript

  1. Olivier Dolbeau
    1

    View full-size slide

  2. Disclaimer
    I used API Platform for a side project.
    I'm NOT an heavy user.
    3

    View full-size slide

  3. Enough documentation!
    18

    View full-size slide

  4. Twitter: @odolbeau
    Mastodon: [email protected]
    Olivier
    Dolbeau
    Web Developer / Architect
    Symfony fan
    #swarrot maintainer
    be[a|e]r lover
    20

    View full-size slide

  5. Time
    Love
    @Annotations
    UUID
    21

    View full-size slide

  6. Side project
    Goal: create a MVP for a SAAS product
    Need: a sexy & dynamic interface
    Let's use API Platform + a random modern JS framework!
    23

    View full-size slide

  7. Basic business rules
    SAAS product: need to deal with clients
    As a client: I can submit documents
    24

    View full-size slide

  8. Project organisation
    25

    View full-size slide

  9. Business organisation
    26

    View full-size slide

  10. Business organisation
    28

    View full-size slide

  11. The storage
    29

    View full-size slide

  12. Find a
    document
    32

    View full-size slide

  13. Business organisation
    33

    View full-size slide

  14. Normalizer
    34

    View full-size slide

  15. Denormalizer
    35

    View full-size slide

  16. Business organisation
    36

    View full-size slide

  17. UserProvider
    40

    View full-size slide

  18. UserInterface
    implementation
    41

    View full-size slide

  19. From Doctrine to ES
    No pain, no gain.
    44

    View full-size slide

  20. From Doctrine to ES
    With UUIDs.
    45

    View full-size slide

  21. From Doctrine to ES
    Without annotations.
    46

    View full-size slide

  22. “ A data provider using Doctrine
    ORM to retrieve data from a
    database is included with the library
    and is enabled by default.
    “ But sometime, you want to
    retrieve data from other sources
    such as another persistence layer, a
    webservice, ElasticSearch or
    MongoDB. Custom data providers
    can be used to do so.
    51

    View full-size slide

  23. We created
    An ItemDataProvider
    A CollectionDataProvider
    A Subscriber to persist our entity
    A custom Normalizer
    66

    View full-size slide

  24. Hydra
    JSON-LD
    Doctrine
    Documentation
    JWT
    Full working
    example without
    Doctrine
    Ecosystem
    69

    View full-size slide

  25. ?
    Performances
    Filters
    Relations
    Pagination
    Extensions
    70

    View full-size slide