Since the introduction of Composer package manager and the PHP standards, writing PHP became easier and more manageable, whereas in the past you were almost forced to use a framework to maintain your project in a professional matter, nowadays this is not necessary, and today I will show you how to glue together a small API project with basic routing, third party packages, and testing without a framework.

There are few reasons why you don’t want to use a framework, you are creating a library, a small app/API, have more control, and so forth, depending on your cases you might want to use a framework don’t get me wrong.

Our goal is to create a simple Blog Api, each post will have an **_id, title, and body, _**you will able to list, create and view a post, we won’t use any database, a simple JSON file that will act as DB should be enough, all request/responses will be in JSON format

As you see, there are some fields and features missing, like a slug, summary, published date, author, tags, categories, and so forth, or the ability to delete/update, I decided to not implement those, and I’ll briefly explain some classes and code without getting into too much detail to make this article shorter if you need an extra explanation of any step please leave it in the comments and I will do my best to help you there.

All code is available in


  • PHP 7.0 or greater
  • Composer
  • Basic knowledge of PHP, classes, composer, MVC pattern

Ok, let’s start!

#php #web-development #programming #developer #api

Write Modern PHP without Framework
30.50 GEEK