# Getting started ## Installing API Platform Core If you are starting a new project, the easiest way to get API Platform up is to install the [API Platform Distribution](../distribution/index.md). It ships with the API Platform Core library integrated with [the Symfony framework](https://symfony.com), [the schema generator](../schema-generator/), [Doctrine ORM](http://www.doctrine-project.org), [NelmioCorsBundle](https://github.com/nelmio/NelmioCorsBundle) and [Behat](http://behat.org). Basically, it is a Symfony edition packaged with the best tools to develop a REST API and sensible default settings. Alternatively, you can use [Composer](http://getcomposer.org) to install the standalone bundle in an existing Symfony Flex project: `composer require api` There is no mandatory configuration options although [many settings are available](configuration.md). ## Before Reading this Documentation If you haven't read it already, take a look at [the Getting Started guide](../distribution/index.md). This tutorial covers basic concepts required to understand how API Platform works including how it implements the REST pattern and what [JSON-LD](http://json-ld.org/) and [Hydra](http://www.hydra-cg.com/) formats are. ## Mapping the Entities API Platform Core is able to automatically expose entities mapped as "API resources" through a REST API supporting CRUD operations. To expose your entities, you can use Docblock annotations, XML and YAML configuration files. Here is an example of entities mapped using annotations which will be exposed through a REST API: ```php offers = new ArrayCollection(); // Initialize $offers as an Doctrine collection } // Adding both an adder and a remover as well as updating the reverse relation are mandatory // if you want Doctrine to automatically update and persist (thanks to the "cascade" option) the related entity public function addOffer(Offer $offer): void { $offer->product = $this; $this->offers->add($offer); } public function removeOffer(Offer $offer): void { $offer->product = null; $this->offers->removeElement($offer); } } ``` ```php description="An offer form my shop" iri="http://schema.org/Offer" /> ``` YAML: ```yaml # api/config/api_platform/resources.yaml resources: App\Entity\Product: ~ App\Entity\Offer: shortName: 'Offer' # optional description: 'An offer from my shop' # optional iri: 'http://schema.org/Offer' # optional attributes: # optional pagination_items_per_page: 25 # optional ``` **You're done!** You now have a fully featured API exposing your entities. Run the Symfony app (`bin/console server:run`) and browse the API entrypoint at `http://localhost:8000/api`. Interact with the API using a REST client (we recommend [Postman](https://www.getpostman.com/)) or an Hydra aware application (you should give [Hydra Console](https://github.com/lanthaler/HydraConsole) a try). Take a look at the usage examples in [the `features` directory](https://github.com/api-platform/core/tree/master/features).