Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
error in Mustache
  • when I use Mustache in my project :

    Fatal Error!



    ErrorException [ Fatal Error ]:
    Class 'Mustache_Engine' not found

    So what do i do?

    PKGPATH/parser/classes/view/mustache.php @ line 68



  • HarroHarro
    Accepted Answer
    Install Mustache?
  • download and copy to vendor folder in apppath/vendor

  • HarroHarro
    Accepted Answer
    I think the idea is that you add it to the composer.json, and install it through composer. It doesn't work when you add it manually to apppath/vendor, the autoloader will not find classes in there.

    I think it is already in there under suggestions...
  • ok 
    now - How to install with composer . :|

    I've installed it with composer , but did not change
  • HarroHarro
    Accepted Answer
    You must be doing something wrong. I've added mustache to my composer.json, and ran a composer update:

    [hverton@catwoman] $ composer update
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
      - Installing mustache/mustache (dev-master 1430ca8)
        Cloning 1430ca884912eaba2b3830856b45685733b16789

    Writing lock file
    Generating autoload files

    And now I can load the class without problems:

    [hverton@catwoman] $ oil console
    Fuel 1.7.2 - PHP 5.5.15 (cli) (Jul 24 2014 12:52:12) [Linux]
    >>> $x = new Mustache_Engine();
    >>> var_dump($x);
    class Mustache_Engine#11 (16) {
    ....
  • Ok - After Update And After New Cloning mustache :| CAN NOT FOUND Mustache_Engine
    C:\wamp\www\alphacms\include\fuelphp>php oil console
    Fuel 1.7.2 - PHP 5.3.13 (cli) (May 14 2012 02:46:11) [WINNT]
    >>> var_dump(new Mustache_Engine());
    PHP Fatal error:  Class 'Mustache_Engine' not found in C:\wamp\www\alphacms\include\fuelphp\fuel\p
    ackages\oil\classes\console.php(117) : eval()'d code on line 1
    PHP Stack trace:
    PHP   1. {main}() C:\wamp\www\alphacms\include\fuelphp\oil:0
    PHP   2. Oil\Command::init() C:\wamp\www\alphacms\include\fuelphp\oil:61
    PHP   3. Oil\Console->__construct() C:\wamp\www\alphacms\include\fuelphp\fuel\packages\oil\classes
    \command.php:99
    PHP   4. Oil\Console->main() C:\wamp\www\alphacms\include\fuelphp\fuel\packages\oil\classes\consol
    e.php:46
    PHP   5. eval() C:\wamp\www\alphacms\include\fuelphp\fuel\packages\oil\classes\console.php:117
    Fatal Error - Class 'Mustache_Engine' not found in PKGPATH/oil/classes/console.php(117) : eval()'d
     code on line 1
  • If your composer setup is correct, you should have C:\wamp\www\alphacms\include\fuelphp\fuel\vendor\mustache\mustache\src\Mustache\Engine.php after installation of the mustache composer package. If not, your setup is incorrect.

    For my test, I have this in my composer.json:

        "require": {
            "php": ">=5.3.3",
            "monolog/monolog": "1.5.*",
            "mustache/mustache": "*",
            "fuelphp/upload": "2.0.1"
        },

  • ok - engine.php ->ok

    i composer.json =>

    {
        "name": "mustache/mustache",
        "description": "A Mustache implementation in PHP.",
        "keywords": ["templating", "mustache"],
        "type": "library",
        "license": "MIT",
        "authors": [
            {
                "name": "Justin Hileman",
                "email": "justin@justinhileman.info",
                "homepage": "http://justinhileman.com"
            }
        ],
        "require": {
            "php": ">=5.2.4"
        },
        "require-dev": {
            "phpunit/phpunit": "*"
        },
        "autoload": {
            "psr-0": { "Mustache": "src/" }
        }
    }

  • HarroHarro
    Accepted Answer
    I was not talking about the composer.json of mustache, but the composer.json of FuelPHP, which is in your installation root (there where oil is, and the readme...).
  • :|

    the mustache.php in Mustache root .
    not loaded . in parser/view/mustache/mustache_view => include apppath/vendor/Mustache/mustache.php

    And my problem was resolved :)
  • HarroHarro
    Accepted Answer
    If you had used composer, that would not have been needed.

    Composer doesn't install in apppath/vendor.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion