A tiny multi-tool for your next big PHP adventure.

3.0.0 2019-10-12 16:00 UTC

This package is auto-updated.

Last update: 2023-01-30 11:27:16 UTC



A tiny multi-tool for your next big PHP adventure.1


  • Easily manage your application’s configuration with Gestalt.

    Supports PHP, YAML, INI and JSON files out of the box.

  • Handle databases with Doctrine’s DBAL and optionally use their ORM.

    The Doctrine database abstraction & access layer (DBAL) offers a lightweight and thin runtime layer around a PDO-like API and a lot of additional, horizontal features like database schema introspection and manipulation through an OO API.

  • Have error handling and formatting to your preference with BooBoo.

    BooBoo is an error handler for PHP that allows for the execution of handlers and formatters for viewing and managing errors in development and production. It won’t end up in your stack trace, is built for logging, designed for extension and handles errors non-blocking by default.

  • Set up lightning fast routing with FastRoute.

    A fast regular expression based request router for PHP. See this article for more details.

  • Use native PHP templates with Plates.

    Plates is designed for developers who prefer to use native PHP templates over compiled template languages, such as Twig or Blade. It supports layouts, inheritance, namespaces, data sharing and comes with built-in escaping helpers.

  • ⚡️ Speed up your (dynamic) web applications by caching with Scrapbook.

    PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.


PHP 7.1.3+ and preferably URL Rewriting enabled.


It is recommended that you install this framework using Composer.

composer require mzdr/micro


micro is basically just a bunch of wrapper functions located under a single namespace called µ. Every file you see in ./micro/functions is also available as a function with the same name.

Let me talk in code to you… 😎


// Returns the instance of the Gestalt (@samrap/gestalt) library.

// You can pretty much do anything you like with it.
$config = µ\config();
$special_var = $config->get('my.stored.variable');

// Need to register routes with the
// FastRoute (@nikic/FastRoute) instance?
µ\router()->get('/home', function () {

    // 🌈 Use your imagination…

    // How about we use the Plates
    // (@thephpleague/plates) template engine? 🤩
    echo µ\template()->render('home');

// Tired of typing µ? 😫 Join the club!
namespace µ {
    router()->get('/', function () {
        $key = 'my-heavy-op';
        $ttl = 300;
        $value = "cached for $ttl seconds.";

        if (cache()->has($key) === false) {
            sleep(2); // So so heavy…

            cache()->set($key, $value, $ttl);

            return $value;

        return cache()->get($key);

// Out there in strange places? 👽 Import it!
namespace alien {
    use function µ\config;

    $done = config()->get('');

Just follow the official documentation of each library listed below or jump into the ./micro/functions folder to get a look under the hood.

Function Documentation


You’re in a hurry? Bootstrap a blank, ready-to-view µ project!

  1. Make new project directory and jump into it.

    mkdir fancy-project && cd $_
  2. Install µ.

    composer require mzdr/micro
  3. Boostrap it.

  4. That’s it! Now how do you check out your project?

    • Create a virtual host and point the document root to the public folder, or…

    • Fire up PHP’s built-in web server, or
      (Doesn’t support .htaccess, you have to include assets without $this->asset(…) cache busting)

    • Just browse to the public folder via your local webserver.
      (You probably need to adjust µ.paths.public in your configs/master.yaml)


This project is licensed under MIT license.

1 It may be tiny and powerful, but it’s not the right tool for every job.