Names and Scopes

    • Use application names with the Slim application’s static method

    Every Slim application may be given a name. This is optional. Names help you get a reference to a Slimapplication instance in any scope throughout your code. Here is how you set and get an application’s name:

    Scope Resolution

    This example fails because the variable is unavailable inside the route callback function.

    Currying

    Fetch by Name

    You can use the Slim application’s getInstance() static method, too: