Introducing and installing API Platform on your machine
Tags: node, php, react, docker
Published: 2018-10-10 14:16:18

---
title: Introducing and installing API Platform on your machine
published: true
description: Your simple guide to install API Platform on your machine and avoid some hassle 
tags: Node, PHP, React, Docker
cover_image: https://thepracticaldev.s3.amazonaws.com/i/zdqvq4uyueeirgvylaei.png
---

I’m a full stack web developer, who takes API seriously. Its been 2 years now and i’m still doing the same steps to create every API i implemented, sure i was automating some stuff using some frameworks who makes things easy, organised and simple starting with [Express](https://expressjs.com/) and [Sails](https://sailsjs.com/), to using [Symfony](https://symfony.com/) and finally [API Platform](https://api-platform.com/)!

Two months ago -give or take I’ve a bad memory- I was thinking that i hope one day i’ll automate the API design and implementation to be much faster, maybe running a couple of PHP commands to create a whole entities with its relationships and API routes, and expose them, with a well auto-generated docs for entities based on annotations -maybe- .. well that till a friend of mine told me about this awesome framework which he stumbled upon and “we need to check it out, this 100% gonna be awesome” — he said. And he was right, they did the same thing i wanted to do AND MORE.

![pffff](https://thepracticaldev.s3.amazonaws.com/i/s5ku4wmmm336gcg29p5x.gif)
<center>pffff!</center>

Enough nonsense, i’m not a good writer anyway. Lets get into installation:

> First of all you need to have docker & [docker-compose](https://docs.docker.com/compose) installed on your machine you, you can install it by following the official docker documentation [here](https://docs.docker.com/install).

1. You need to clone API Platform repo, by running this command `git clone git@github.com:api-platform/api-platform.git`
2. Then while you’re standing on the main root of the repo. run the following command to actually run the platform containers `docker-compose up -d`

    > **If you’ve ran into this error or similar**
    > ```ERROR: for client Cannot start service client: driver failed programming external connectivity on endpoint api-platform_client_1 (7d82cb397e0a882f7474f227541ca43eb804316ece68c8a7dc5ac9af91972202): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use```
    > that actually self explanatory it means that port 80 is in use in your current OS, so check which service is using it and kill it or better change its port. In my case this service was apache so a simple sudo service apache2 stop was enough to do the trick.
3. Everything should be working now, `docker-compose up -d` should be full with green done statements indicating everything is working. You should be able to head to `http://localhost` first then navigating to `https://localhost` and see the cool API Platform PWA client.

![pffff](https://thepracticaldev.s3.amazonaws.com/i/z5wcl64ea1fnbujt5iu5.gif)

> **But what if its not!**
> You may run into this [issue here](https://github.com/api-platform/api-platform/issues/730), Its okay i ran into it and [jcarrier-vp solution](https://github.com/api-platform/api-platform/issues/730#issuecomment-399941316) did it for me.

You’re now ready to create your API and consider following [API Platform awesome documentation](https://api-platform.com/docs/distribution) its really helpful and they have a cool walk through that will help you get to know it more.