New PHP Framework MARKO is Actually Insane
Chapters8
Introducing Marco as a modular PHP 8.5+ framework with strict modularity and no magic, where features are composer packages and errors are explicit.
Marco is a lean, modular PHP 8.5+ framework focused on explicitness and composable features, shown through a hands-on API example.
Summary
Tony Xhepa dives into Marco, a new PHP framework described as modular, zero-magic, and built for clarity. He highlights Marco’s promise of true modularity where every feature is a composer package, making interfaces and implementations swappable without touching the rest of the codebase. The framework emphasizes explicit error handling, with detailed context and actionable fixes. Tony walks through a minimal API project: installing via composer create-project marco/skeleton, creating a post module, and wiring a simple REST API with routes for listing, creating, showing, updating, and deleting posts. He stresses PHP 8.5 compatibility and required extensions like MBString, OpenSSL, PDO, and JSON. The project structure is intentionally lean: an app directory, a single Post module, and a small source tree for HTTP controllers, models, and repositories. He demonstrates a concrete API workflow (200 OK with empty array, 201 Created after posting, 404 on missing post, etc.) and praises the framework’s minimalism and discoverability. If you’re curious about a PHP framework that focuses on explicitness and modularity over magic, Tony’s not-so-subtle praise makes Marco worth a closer look.
Key Takeaways
- Marco uses true modularity where each feature is a composer package, enabling swapping interfaces and implementations without changing other parts.
- PHP 8.5 is required, with extensions MBString, OpenSSL, PDO, and JSON, plus Composer for dependency management.
- Install via composer create-project marco/skeleton and scaffold a minimal API with composer require marco/framework minimal API headless.
- The app structure is intentionally lean: app directory, one Post module, and no vendor-modified core—only the essentials for a REST API.
- The Post module demonstrates a complete CRUD flow (GET /post, POST /post, GET /post/{id}, PUT /post/{id}, DELETE /post/{id}) with validation and error handling.
- Marco emphasizes explicitness over magic: no magic methods, no hidden conventions, and errors that include context and fix suggestions.
- The CLI tool Marco CLI and a predictable, type-safe workflow help maintain code discoverability and reduce silent failures.
Who Is This For?
Developers curious about new PHP frameworks that prioritize modularity and explicit behavior over magic, especially those evaluating options beyond Laravel for API backends.
Notable Quotes
"Marco is a modular PHP 8.5 plus framework combining Magento's extensibility with Laravel's developer experience."
—Tony quotes the framework’s positioning as a blend of Magento extensibility with Laravel-like UX.
"true modularity every feature is a composer package interface and implementation are split."
—Definition of Marco’s core modular philosophy.
"Explicit over implicit, so no magic methods, no hidden conventions."
—Emphasizes Marco’s stance on discoverability and type safety.
"Every error includes what went wrong, the context and a suggestion for how to fix it."
—Highlight of Marco’s error reporting design.
Questions This Video Answers
- What makes Marco different from Laravel in terms of modularity and error handling?
- How do you install and bootstrap a minimal API using Marco framework 8.5?
- Can Marco’s composer-based modules actually replace parts of the app without touching core code?
- What are the required PHP extensions for Marco and why do they matter for performance and security?
- Is Marco suitable for building small REST APIs or only large applications?
PHP 8.5Marco frameworkComposerModularityZero magicLaravel alternativeREST APIPHP extensions (MBString, OpenSSL, PDO, JSON)CLI toolingPost module
Full Transcript
Hello friends, Tony here. Welcome. In today's video, I'm not going to work with Laravel. I'm not going to work with AI. I'm going to work with another PHP framework, which is a new framework. You can find that on the marco.bu. And here is the website. Now, Marco is a modular PHP 8.5 plus framework combining Magento's extensibility with Laravel's developer experience. So, the Marco framework is built by Laravel developer loud errors, true modularity and zero magic. You can get started here. So why Marco true modularity every feature is a composer package interface and implementation are split.
Swap any piece without touching the rest. Loud error so no silent failures. Every error includes what went wrong, the context and a suggestion for how to fix it. Explicit over implicit, so no magic methods, no hidden conventions. Everything is discoverable and type safe. Accessibility builtin. So preferences, plugins, events, and observers. Customize any behavior without modifying vendor code. Quick start. You can run the composer if you you need to run to have the composer. So you have the installation here and so on. So you got to installation. We have requirements PHP 8.5. You need PHP because this is a PHP framework.
Then we have the ext we need the extension the MB string extension open SSL extension PDO and JSON only for extensions. Of course you need the composer and then you can create a project by saying composer create project marco/ skeleton give it a name and then cd in your app. A full web application you can say composer require marco/framework minimal API headless and CLI directory structure is something like this also install CLI composer global require marco cli make sure the composer global bin directory is in your path so add this but we have the composer in the because we I'm using with Claravel and I have her installed.
So we have the Hert composer path but anyway and yeah you can say verify it works smart list and I have prepared a project using the AI of course and the project is a postcr we're going to work with API not a full stack project. So let me just show you the project and then show you the code. So here is we have this hello marco.est because the project is inside the her directory and we can access also that in the test domain. Now I have a get post store post uh show post a typo here so I rename that show post edit post and delete post.
Okay get post. We navigate the hello marco dot hello-ar test/post. Then we have a store post. Then we have a show post edit and delete. Now get post. If I hit the get a post, we have an empty array. We have 200 JSON response but is empty. If I go to store post here, I have added on the body JSON with title and the content. Hello Marco body example. If I hit and also this is a post method not get and if I hit enter we have errors body the body field is required because we have body on the database.
Okay. So we have errors. If I change that body and let's save first and I'm going to hit enter again. Now we have 2011 created and it's going to return back the post with ID title body created at and updated at. Then if I go back to get post to get all the posts and if I hit again it's going to return only one post. If I create another one hello Marco 2 for example and I'm going to hit enter. Now we have hello Marco 2 with ID2 which mean if I go here and hit enter now we have two posts.
Good. We have also the show get hello Marco/post / one. And if I hit enter we have hello Marco. If I hit the ID2 enter now we have hello Marco 2. Edit post. The same thing. Let's update the uh hello Marco one. Just hello Marco dot dot dot. Okay, hello Marco dot dot dot. If I come here, hit enter. Now we have hello Marco dot dot dot here. And also we can delete. So let's delete the post number two with heading number two. We have a delete method with http and delete and message post deleted.
which mean if I go here and hit enter we have only one post we don't have authentication just a simple post craft now let's show you the code and here is the marco application we have app directory config directory modules public storage and the vendor yeah we have the MV example composer JSON composer log license and readme. Now inside the app we don't have anything special. We have only the post directory because we created this postgraph inside the config nothing modules nothing public only the index. Okay, here it's going to declare first and then require vendor autoload PHP and use marco core application app application boot pass in the dear name and app handle requests and inside the storage just post JSON.
Now let's go to post. Here we have a module and a composer JSON name app/post description postcrat module and here we have extra marco module here is the marco is going to understand and is going to load this module autoload PCR4 app post inside the source slash here we have source let's see also the module here we have bindings just return an array with bindings post repository interface the JSON post repository and let's show you inside the source we have repositories and we have a post repository here interface with public function all find create update and delete with the ID.
So for example find has a id parameter which is integer create title and body update id title and the body and also to delete only the ID. Let's go to JSON post repository using the storage path here construct and then we have all return an array map fn array data post from array passing the data array values this load we have a find we have a create we have a update method a delete method the load method the save method okay we have models here post model this is a PHP class or read only class with a construct ID, title, body, created add and updated ad and also public function to array returning ID this id title list title and so on and the same from array passing the data returning a self here with ID data ID title data title data body created and updated then let's see the STP here we have the controllers First post controller like Laravel and this is a PHP class.
First we have the construct private read only post repository interface the last post and also validator interface the lassan validator. Then we have a index method and here we define the get the route. So get / post then we get all the posts this post all and return response JSON array map fn post plus sign post array and also here the last sign post then we have the store method defined here post route /post data this input request now input is a method down Here's a private function input receiving the request post request post and if post is not equal with an empty array return the post also body request body if body is not an empty string decode JSON decode body to true body true and if is decoded return decoded otherwise return an empty array.
So [snorts] we are on the store errors this validator validate pass in data which comes here and then title in the body required like a required string min55 and also the body the same if error is not empty it's going to return response JSON errors errors old 422 otherwise it's going to say post this post create string data title and string data body and return response JSON post array and also the 201. Then we have the show method get / post slash id and here is going to receive that ID post this post find pass in that ID and if post is null it's going to return response JSON message post not found 404 otherwise it's going to return response JSON the array and we have also the update and the destroy method now uh I don't know for about you but I kind of like this uh framework.
It's very clean. You can see what we have inside the application is this app directory which has only the postgrat we created folder inside the config nothing modules nothing public just index and that's it very lean framework has only what you need so for example for the post API crow we have only this post directory and inside here in this post directory we have what we need. So we have post mode.php, we have composer JSON, we have the source directory with the HTTP models and repository. And that's it all about this video. Now if you like this uh framework, drop a comment and I'm going to create more content.
But I'm sure I'm going to create more content because I like this uh framework. I like how lean it is. And that's it all about this video. Don't forget to subscribe, like the video, share with friend because it's going to help to create a content like this. And I'm going to see you in another video. All the best.
More from Tony Xhepa
Get daily recaps from
Tony Xhepa
AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.









