# State Providers To retrieve data exposed by the API, API Platform uses classes called **state providers**. A state provider using [Doctrine ORM](https://www.doctrine-project.org/projects/orm.html) to retrieve data from a database, a state provider using [Doctrine MongoDB ODM](https://www.doctrine-project.org/projects/mongodb-odm.html) to retrieve data from a document database, and a state provider using [Elasticsearch-PHP](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html) to retrieve data from an Elasticsearch cluster are included with the library. The first one is enabled by default. These state providers natively support paged collections and filters. They can be used as-is and are perfectly suited to common uses. However, you sometimes want to retrieve data from other sources such as another persistence layer or a webservice. Custom state providers can be used to do so. A project can include as many state providers as needed. The first able to retrieve data for a given resource will be used. To do so you need to implement the `ApiPlatform\State\ProviderInterface`. In the following examples we will create custom state providers for an entity class called `App\Entity\BlogPost`. Note, that if your entity is not Doctrine-related, you need to flag the identifier property by using `#[ApiProperty(identifier: true)` for things to work properly (see also [Entity Identifier Case](serialization.md#entity-identifier-case)). ## State Provider If the [Symfony MakerBundle](https://symfony.com/doc/current/bundles/SymfonyMakerBundle) is installed in your project, you can use the following command to generate a custom state provider easily: ```console bin/console make:state-provider ``` Let's start with a State Provider for the URI: `/blog_posts/{id}`. First, your `BlogPostProvider` has to implement the [`ProviderInterface`](https://github.com/api-platform/core/blob/main/src/State/ProviderInterface.php): ```php