Help us understand the problem. What is going on with this article?

fuelphp1.7.2をzipで入れた場合にcomposer使うとfuelが動かなくなる

More than 5 years have passed since last update.

fuelphp1.7.2のzipを解凍して設置すると正常に動作しますが、
この状態でcomposerを使うとfuelが動かなくなるので注意。

php composer.phar install

とかを実行すると以下のエラーになる

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files

Fatal error: Class 'Monolog\Logger' not found in /path/to/fuel/core/classes/log.php on line 100

Fatal error: Class 'Monolog\Logger' not found in /path/to/fuel/core/classes/log.php on line 100
Script php oil r install handling the post-install-cmd event returned with an error

  [RuntimeException]  
  Error Output:       

この状態になるとブラウザから接続した際も以下のエラーが出て動かない

Fatal error: Class 'Monolog\Logger' not found in /path/to/fuel/core/classes/log.php on line 100

恐らく1.7.2からの変更点としてfuel/coreなどのリポジトリをcomposerからインストールできるようになった変更が影響しているのだと思います。今の問題は、zipに含まれる fuel/vendor 以下のパッケージがcomposerで管理されていないのが原因。

以下の作業ですべてcomposerで管理するようにすれば解決した

fuel/vendor のディレクトリごと削除

fuel/vendorのディレクトリごと削除します。
少なくともfuel/vendor/composer は消さないと以下のエラーが出ます

[RuntimeException]                                                                                                                                    
  The .git directory is missing from /path/to/fuel/vendor/composer/installers, see http://getcomposer.org/commit-deps for more information   

composer.json の内容を編集

zipのcomposer.jsonにはmonolog等をインストールする記述がなくなってるので、1.7.2でzipに含まれていたパッケージをインストールするようにcomposer.jsonを修正します

composer.json
{
    "name": "fuel/fuel",
    "type": "project",
    "description" : "FuelPHP is a simple, flexible, community driven PHP 5.3+ framework, based on the best ideas of other frameworks, with a fresh start!",
    "keywords": ["application", "website", "development", "framework", "PHP"],
    "license": "MIT",
    "require": {
        "php": ">=5.3.3",
        "composer/installers": "~1.0",
        "monolog/monolog": "1.5.*",
        "fuelphp/upload": "2.0.*",
        "michelf/php-markdown": "1.4.*"
    },
    "suggest": {
        "dwoo/dwoo" : "Allow Dwoo templating with the Parser package",
        "mustache/mustache": "Allow Mustache templating with the Parser package",
        "smarty/smarty": "Allow Smarty templating with the Parser package",
        "twig/twig": "Allow Twig templating with the Parser package",
        "pyrocms/lex": "Allow Lex templating with the Parser package",
        "mthaml/mthaml": "Allow Haml templating with Twig supports with the Parser package"
    },
    "config": {
        "vendor-dir": "fuel/vendor"
    },
    "scripts": {
        "post-install-cmd": [
            "php oil r install"
        ]
    },
    "minimum-stability": "dev"
}

具体的には

        "monolog/monolog": "1.5.*",
        "fuelphp/upload": "2.0.*",
        "michelf/php-markdown": "1.4.*"

を追加してます

Composerでパッケージインストール実行

php composer.phar self-update
php composer.phar update

これでブラウザから接続したら復旧してるはず。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away