问题描述:

I've installed https://github.com/pug-php/pug using composer and now I have a subdirectory vendor/pug-php/pug in my project but I can't figure out how to use it.

If I try

$pug = new Pug();

I obviously got

Class 'Pug' not found

How can I use it?

网友答案:

If you installed pug with composer you should find an autoloader.php in your vendor folder.

This made it work:

use Pug\Pug;
include('vendor/autoload.php');
网友答案:

Take a look at the examples in pug:
https://github.com/pug-php/pug/blob/master/example/index.php

This shows how you use it standalone.

The autoloader, which is missing in your question, you can find here:
https://github.com/pug-php/pug/blob/master/example/bootstrap.php

相关阅读:
Top