Search code examples
phpphrets

How to install PHRETS 2.0?


What are all the step by step process to install phrets in ubuntu?

I tried the following, but then unable to run phrets

  • First I got installed composer.

  • Then I ran composer require troydavisson/phrets

  • Now I have two files composer.json and composer.lock, and a folder named "vendor"

  • Inside vendor folder, I can see autoload.php file and some other folders

Now I tried the sample code from phrets git

But then am getting the following error,

PHP Fatal error: Class 'Monolog\Logger' not found in /var/www/testing/newphrets.php on line 7

Please advice what am missing here. Am planning to switch my project from old version to phrets 2.0.

Thanks


Solution

  • According to Troy's PHRETS 2.0 Logging video on YouTube and looking at PHRETS' composer.json, you can see that you need to do one of two things. Either,

    (a) Add monolog to your project's composer.json,

    {
        "require": {
            "troydavisson/phrets": "2.*",
            "monolog/monolog": ">=1.10"
        }
    }
    

    and run composer update in your project's root directory.

    or,

    (b) Since monolog is in PHRETS' composer.json file but in the require-dev section, run composer install --dev or composer update --dev to indicate you're currently in development and would like to use the development libraries.