DEV Community

Cover image for Introducing and installing API Platform on your machine
Omar Ahmed
Omar Ahmed

Posted on

Introducing and installing API Platform on your machine

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 and Sails, to using Symfony and finally API Platform!

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.



Enough nonsense, i’m not a good writer anyway. Lets get into installation:

First of all you need to have docker & docker-compose installed on your machine you, you can install it by following the official docker documentation here.

  1. You need to clone API Platform repo, by running this command git clone
  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 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.


But what if its not!
You may run into this issue here, Its okay i ran into it and jcarrier-vp solution did it for me.

You’re now ready to create your API and consider following API Platform awesome documentation its really helpful and they have a cool walk through that will help you get to know it more.

Discussion (0)