There is a couple of reasons it wouldn't work:
public __construct(){};
is not the correct way to define a class construct.
If that's just a typo the actual error you would be getting is:
Fatal error: Call to a member function getDefinition() on a non-object
in ...
This is because if you extend a class which has a construct, then you must call the parent construct or it will discard it. (which it does).
So putting them 2 points together here is a working example:
<?php
// require 'vendor/autoload.php';
use League\Container\Container;
class App extends Container {
public function __construct() {
parent::__construct();
}
}
class Foo {
}
$container = new App;
// add foo to the container
$container->add('foo', 'Foo');
// retrieve foo from the container
$service = $container->get('foo');
var_dump($service instanceof Foo); // true