Simple router in PHP Before I start writing my first MVC framework, I want to improve my code quality as much as I can, can anyone give me some constructive criticism on how I can improve this?

It is a simple router, built for simple use. It should be pretty simple what's going on, and the usage should be easy to picture. It's nothing major but works well for simple functionality using it.

&lt;?php

class Router {

    public $routes = [];
    public $routeMethods = [];

    public function get($route, $settings) {
        $this-&gt;add($route, $settings, ['GET']);
    }

    public function post($route, $settings) {
        $this-&gt;add($route, $settings, ['POST']);
    }

    public function add($route, $settings, $methods) {
        $this-&gt;routes[$route] = $settings;
        $this-&gt;routeMethods[$route] = $methods;
    }

    public function dispatch() {
        $requestUrl = $_SERVER['QUERY_STRING'];

        if (array_key_exists($requestUrl, $this-&gt;routes)) {
            $route = $this-&gt;routes[$requestUrl];
            $methods = $this-&gt;routeMethods[$requestUrl];
            $method = $_SERVER['REQUEST_METHOD'];

            if (!in_array($method, $methods)) {
                echo 'Method ' . $method . ' not allowed.';
            }
            else {
                $controller = $route['controller'];

                if (class_exists($controller)) {
                    $class = new $controller(); // grab from di cache when we have one
                    $action = $route['action'];

                    if (method_exists($class, $action)) {
                        $class-&gt;$action();
                    }
                    else {
                        echo 'We couldn\'t find action \'' . $action . '\ in controller \'' . $controller . '\'';
                    }
                }
                else {
                    echo 'We couldn\'t find controller \'' . $controller . '\'';
                }
            }
        }
        else {
            echo '404 not found';
        }
    }

}
set public $routes to private or protected if its jsut an internal resource of this class. Just use public if other classes/code explicitly should call the mothod/property
method_exists doesn't check if the method is callable. But that might be important if you execute legacy code
Avoid echo 'some text' Better use exceptions and an exception handler
If you use if (){} else{} you could think about using the if for the termination condition and the function continues regulary if its ok
Your note about the dependency injection cache is good. Keep your idea. You are on the rigth way.
I would recommend to use doc-blocks as annotation and for IDE autocompletion for all public functions as well as class properties. This will increase the readability 
You didn't said which version of PHP you are using. Switch to >= 7.1 because 7.0 will reach its end of life soon. So you should use return types and type hinting