use MABS\App\Application; $app = new Application([ 'debug' => true, 'timezone' => 'UTC', 'services' => [ 'database' => [ 'dsn' => 'mysql:host=localhost;dbname=mydb', 'username' => 'myuser', 'password' => 'mypassword' ] ] ]); $dbh = $app->getDb(); $stmt = $dbh->query('SELECT * FROM users'); $results = $stmt->fetchAll();
use Symfony\Component\HttpFoundation\Request; use MABS\App\Application; $app = new Application(); $app->get('/hello/{name}', function ($name) { return 'Hello '.$name; }); $request = Request::createFromGlobals(); $response = $app->handle($request); $response->send();In this example, we create a new instance of the `Application` class and define a route that accepts a name parameter. We then create a new `Request` object from the global variables and pass it to the `$app` instance to handle it. Finally, we send the response to the client. Package Library: MABS/App, Symfony/HttpFoundation Overall, PHP App instance is a useful package library for PHP developers who want to quickly bootstrap their application and manage configuration and services. It provides a simple and elegant solution for building robust applications.