Level 18
It looks like a minor typo. The bind method uses static::$registry but the get method is using static::$registery. That should at least fix the error you're getting.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
App.php
<?php
class App {
protected static $registry = [];
public static function bind($key, $value) {
static::$registry[$key] = $value;
}
public static function get($key) {
if (! array_key_exists($key, static::$registery)) {
throw new Exception("No {$key} is bound in the container");
}
return static::$registery[$key];
}
}
Bootstrap.php
<?php
App::bind('config', require 'config.php');
dd(App::get('config'));
App::bind(
'database', new QueryBuilder(
Connection::make(App::get('config')['database'])
)
);
Error:
PHP Fatal error: Uncaught Error: Access to undeclared static property: App::$registery in /opt/lampp/htdocs/laracasts/php-mysql/core/App.php:11
Stack trace:
#0 /opt/lampp/htdocs/laracasts/php-mysql/core/bootstrap.php(5): App::get('config')
#1 /opt/lampp/htdocs/laracasts/php-mysql/index.php(6): require('/opt/lampp/htdo...')
#2 {main}
thrown in /opt/lampp/htdocs/laracasts/php-mysql/core/App.php on line 11
It looks like a minor typo. The bind method uses static::$registry but the get method is using static::$registery. That should at least fix the error you're getting.
Please or to participate in this conversation.