private function modifyComposerFile()
    {
        if (!is_writeable('composer.json')) {
            throw new Exception('Make sure a composer.json file exists and is writable');
        }

        $json = file_get_contents('composer.json');
        $composer = json_decode($json);

        if (!isset($composer->autoload) || !isset($composer->autoload->{'psr-4'})) {
            $composer->autoload = new stdClass();
            $composer->autoload->{'psr-4'} = new stdClass();
        }

        // Composer namespaces requires an extra slash at the end
        $namespace = $this->namespace . '\\';
        $composer->autoload->{'psr-4'}->{$namespace} = 'src';

        file_put_contents('composer.json', json_encode($composer, JSON_PRETTY_PRINT));
    }