-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New getting started #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New getting started #109
Conversation
tutorial/api.md
Outdated
|
|
||
| * empty the `app/config/schema.yml` file | ||
| * delete all PHP files in the `src/AppBundle/Entity/` directory | ||
| Start by [downloading the API Platform Standard Edition](https://api-platform.com/download) and extract the content of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a plan to update this page? As naive user, when I am on this page I see composer create-project api-platform/api-platform my-project or a link to https://github.com/api-platform/api-platform but no archive. It's confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I'll do it when the new doc will be ready.
|
Ping @api-platform/core-team, the main new tutorial is ready to be reviewed. |
tutorial/api.md
Outdated
|
|
||
| Let's start our new blog API project. The easiest way to create a new project is to use [Composer](https://getcomposer.org/) | ||
| (you need to have it installed on your box): | ||
| API Platform is shipped with a entire [Docker](https://docker.com) setup that makes it easy to get a containerized development |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with a entire Docker setup
| Let's start our new blog API project. The easiest way to create a new project is to use [Composer](https://getcomposer.org/) | ||
| (you need to have it installed on your box): | ||
| API Platform is shipped with a entire [Docker](https://docker.com) setup that makes it easy to get a containerized development | ||
| environment up and running. This setup contains an image pre-configured with PHP 7, Apache and everything needed to run API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw stack could be simplified with php-fpm (nothing to do with the getting-started guide though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, PR welcome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, if we remove apache php-fpm will listen on an upstream (like localhost:8080). Is it sufficient or you'd prefer having localhost (eg nginx proxy on top)?
tutorial/api.md
Outdated
|
|
||
| composer create-project api-platform/api-platform:dev-master blog-api | ||
| *Alternatively to using Docker, API Platform can also be installed using [Composer](https://getcomposer.org/): | ||
| `composer create-project api-platform/api-platform bookshop-api`.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an alternative to Docker, API Platform can also be installed using Composer:
composer create-project api-platform/api-platform bookshop-api
Why emphasis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's italic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why italic ? :P
tutorial/api.md
Outdated
| `composer create-project api-platform/api-platform bookshop-api`.* | ||
|
|
||
| Composer creates the skeleton of the new blog API then retrieve the framework and all its dependencies. | ||
| Start by [downloading the API Platform Standard Edition](https://api-platform.com/download) and extract the content of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and extract it's content.
| Composer creates the skeleton of the new blog API then retrieve the framework and all its dependencies. | ||
| Start by [downloading the API Platform Standard Edition](https://api-platform.com/download) and extract the content of the | ||
| archive. | ||
| The resulting directory contains an empty API Platform project structure. You will add your own code and configuration inside |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this sentence is needed as we repeat "go inside the directory containing your project skeleton" below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO It's less clear without it.
tutorial/api.md
Outdated
| and is very useful for open data, SEO and interoperability when [used with open vocabularies such as Schema.org](http://blog.schema.org/2013/06/schemaorg-and-json-ld.html). | ||
| JSON-LD enables a lot of awesome advanced features (like [giving access to Google to your structured data](https://developers.google.com/search/docs/guides/intro-structured-data) | ||
| or consuming APIs with [Apache Jena](https://jena.apache.org/documentation/io/#formats)). | ||
| Wwe think that it's the best default for a new API. However, API Platform natively [supports many other formats](../core/content-negotiation.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We think that it's the best default format for a new API. However, API Platform natively supports many other formats
tutorial/api.md
Outdated
| Thanks to [NelmioApiDocBundle](https://github.com/nelmio/NelmioApiDocBundle) support of ApiBundle and its integration | ||
| with API Platform, you get for a free **an automatically generated human-readable documentation** of the API (Swagger-like). | ||
| The doc also **includes a sandbox** to try the API. | ||
| There is 2 interesting things to mention about this request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are
tutorial/api.md
Outdated
| it. You can use this IRI to reference this document from other documents. In the previous request, we used the IRI of the | ||
| book we created earlier to link it with the `Review` we were creating. API Platform is smart enough to deal with IRIs. | ||
| By the way, you may want to [embed documents](../core/serialization-groups-and-relations.md) instead of referencing them (e.g. to reduce the number of HTTP requests | ||
| to issue). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(e.g. to reduce the number of HTTP requests to issue).
tutorial/api.md
Outdated
| ``` | ||
| Did you notice that the error was automatically serialized in JSON-LD and respect the Hydra Core vocabulary for errors? | ||
| It allows the client to easily extract useful information from the error. Anyway, it's bad to get a SQL error when submitting | ||
| a request. It means that we doesn't valid use input, and [it's a very bad and dangerous practice](https://www.owasp.org/index.php/Input_Validation_Cheat_Sheet). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means that we doesn't use a valid input,
tutorial/api.md
Outdated
| The API Platform flavor of Behat also comes with a temporary SQLite database dedicated to tests. It works out of the box. | ||
|
|
||
| Simply run `vendor/bin/behat`. Everything should be green: | ||
| After updating the entities to add those `@Assert\*` annotations (as for Doctrine, you can use XML or YAML formats if you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by adding those @Assert\* annotations
core/getting-started.md
Outdated
| ``` | ||
| There is no mandatory configuration. However, a lot of [configuration parameters](configuration.md) are available. | ||
| There is no mandatory configuration. However, a bunch of [configuration parameters](configuration.md) are available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no mandatory configuration although some parameters are configurable.
tutorial/api.md
Outdated
|
|
||
| To follow this tutorial a database must be installed (but its not a strong dependency of the framework). We recommend MySQL | ||
| or MariaDB but other major DBMS are supported including PostgreSQL and SQLite. | ||
| [API Platform](https://api-platform.com) is the most efficient framework out there to create web APIs. It makes it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the most efficient modern PHP framework to create web APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It changes the meaning of the sentence ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a marketing sentence. Someone can argue that Apigility or FOSRest or anything else is more efficient. Someone can also argue that Django REST or Loopback is more efficient. It's just subjective marketing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think marketing belongs in the documentation. It's a very bold claim and it makes me feel uncomfortable as a reader when I see such expletives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use adjectives, but expletives should be avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you suggest an alternative wording? What do you think about "API Platform is one the most efficient framework out there to create web APIs."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep the "best in the world" or "best framework out there" part in the homepage, let's be more neutral for the doc :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API Platform is a framework for creating modern web APIs efficiently.
core/getting-started.md
Outdated
| ``` | ||
| There is no mandatory configuration. However, a lot of [configuration parameters](configuration.md) are available. | ||
| There is no mandatory configuration configuration although [some parameters](configuration.md) are configurable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configuration configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configuration != parameters in Symfony speak. We should not use terms that may lead to confusion.
tutorial/api.md
Outdated
|
|
||
| To follow this tutorial a database must be installed (but its not a strong dependency of the framework). We recommend MySQL | ||
| or MariaDB but other major DBMS are supported including PostgreSQL and SQLite. | ||
| [API Platform](https://api-platform.com) is the most efficient framework out there to create web APIs. It makes it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think marketing belongs in the documentation. It's a very bold claim and it makes me feel uncomfortable as a reader when I see such expletives.
tutorial/api.md
Outdated
|
|
||
| To follow this tutorial a database must be installed (but its not a strong dependency of the framework). We recommend MySQL | ||
| or MariaDB but other major DBMS are supported including PostgreSQL and SQLite. | ||
| [API Platform](https://api-platform.com) is the most efficient framework out there to create web APIs. It makes it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use adjectives, but expletives should be avoided.
tutorial/api.md
Outdated
| To follow this tutorial a database must be installed (but its not a strong dependency of the framework). We recommend MySQL | ||
| or MariaDB but other major DBMS are supported including PostgreSQL and SQLite. | ||
| [API Platform](https://api-platform.com) is the most efficient framework out there to create web APIs. It makes it | ||
| easy to create simple APIs with support of industry leading open standards while giving you the ability to create complex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simple APIs
This gives the wrong idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the support of
tutorial/api.md
Outdated
| or MariaDB but other major DBMS are supported including PostgreSQL and SQLite. | ||
| [API Platform](https://api-platform.com) is the most efficient framework out there to create web APIs. It makes it | ||
| easy to create simple APIs with support of industry leading open standards while giving you the ability to create complex | ||
| features with style. To discover the basics, we will create an API to manage a bookshop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create complex features with style?
I'm not sure what this part of the sentence is trying to say...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should rephrase this sentence to something like this:
It makes it easy to start creating APIs with the support of industry-leading open standards, while giving you the flexibility to build complex features.
tutorial/api.md
Outdated
| * filtering | ||
| * sorting | ||
| * content negotiation | ||
| * a nice UI and machine-readable documentations ([Swagger/OpenAPI](https://swagger.io), [Hydra](http://hydra-cg.com)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation (uncountable)
tutorial/api.md
Outdated
|
|
||
| While API Platform is perfectly integrated with Symfony, keep in mind that it's basically a set of standalone PHP components. | ||
| You can also use those components in raw PHP (without framework) as well as with other frameworks. | ||
| If you're used to the PHP ecosystem, you probably guessed that this test entity uses the industry leading [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
industry-leading
5d2188e to
4740bd1
Compare
|
This PR is ready now. Can you review please? |
WIP