Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Incorrect instructions for slim/twig-view #13

@Mark-H

Description

@Mark-H

According to http://docs-new.slimframework.com/features/templates/ ("Register the view service"), the code to use is:

// Create Slim app
$app = new \Slim\App();

// Register Twig View service
$app->register(new \Slim\Views\Twig('path/to/templates', [
    'cache' => 'path/to/cache'
]));

However that throws a fatal error Call to undefined method Slim\App::register().

From the readme at https://github.com/slimphp/Twig-View it seems the correct code is actually:

// Create Slim app
$app = new \Slim\App();

// Fetch DI Container
$container = $app->getContainer();

// Register Twig View helper
$container->register(new \Slim\Views\Twig('path/to/templates', [
    'cache' => 'path/to/cache'
]));

.. which seems to at least get rid of the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions