composerでHybridAuthをいれてみた

HybridAuth, Open Source Social Sign On PHP Libraryをcomposerでいれてみました

環境は
Ubuntu 14.04
php 7.0

$ composer require hybridauth/hybridauth:~2.6.0

するとエラーが..

Problem 1
    - Installation request for hybridauth/hybridauth ~2.6.0 -> satisfiable by hybridauth/hybridauth[v2.6.0].
    - hybridauth/hybridauth v2.6.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.

ext-curlがないらしい
必要なものをいれてみます

$ sudo apt-get update
$ sudo apt-get install php-curl

これで再度

$ composer require hybridauth/hybridauth:~2.6.0

でうまく入りました

phpDocumentorをcomposerでいれてみた

phpDocumentorをcomposerでいれてみました

環境は
Ubuntu 14.04
php 7.0

https://www.phpdoc.org/docs/latest/getting-started/installing.html
だと条件が

  • PHP 5.3.3
  • intl extension for PHP
  • Graphviz
  • xsl extension for PHP

なので、必要なものをいれます

$ sudo apt-get install php7.0-intl graphviz php7.0-xsl

準備出来たのでphpDocumentorをいれます

$ composer require “phpdocumentor/phpdocumentor:2.*”

で入るはずが、symfony/consoleがいるとかでうまくいかず
試行錯誤した結果

composer.jsonに追記して

    "require-dev": {                                                               
        "symfony/console": "*",                                                                                                                                                                              
        "phpdocumentor/phpdocumentor": "*"                                         
    },  

インストール
$ composer install

これでインストールできました
実行してみます

$ php vendor/bin/phpdoc -d src e -t docs/api

無事、生成できました

Xdebug impact on Composerの対策をしてみた

composerを起動するたびに
Xdebug impact on Composer
の警告が出て、実行が遅いので対策してみました

環境は
Ubuntu 14.04
php 7.0

composer実行時にxdebugを読み込まないようにするため、.bashrcに書込み

$ echo ‘function composer() { COMPOSER=”$(which composer)” || { echo “Could not find composer in path” >&2 ; return 1 ; } && sudo phpdismod -s cli xdebug ; $COMPOSER “$@” ; STATUS=$? ; sudo phpenmod -s cli xdebug ; return $STATUS ; }’ >> ~/.bashrc
. ~/.bashrc

参考: Troubleshooting - Composer

参考サイトをちょっと環境に合わせて変えてます
これで実行が早くなりました

ComposerでCakephpを入れてみた

phpのパッケージマネージャーのComposerでCakephpとPHPUnitを入れてみました
Ubuntu 14.04で試しました

システム全体で使えるようにしました
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer

参考)https://getcomposer.org/doc/00-intro.md

これで
$ composer
だけで呼び出せます

インストールするものをcomposer.jsonに記載します
まず、cakephpを入れてみました

$ vim composer.json

{
    "name": "example-app",
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.cakephp.org"
        }
    ],
    "require": {
        "cakephp/cakephp": ">=2.4.9"
    },
    "config": {
        "vendor-dir": "Vendor/"
    }
}

参照) http://book.cakephp.org/2.0/ja/installation/advanced-installation.html

インストール
$ composer install
Loading composer repositories with package information
Initializing PEAR repository http://pear.cakephp.org
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - cakephp/cakephp 2.6.1 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.6.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.8 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.7 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.6 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.5 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.4 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.3 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.1 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.5.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.4.9 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - cakephp/cakephp 2.4.10 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - Installation request for cakephp/cakephp >=2.4.9 -> satisfiable by cakephp/cakephp[2.4.10, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.6.0, 2.6.1].

エラー発生..mcryptがない..ということで

$ sudo apt-get install php5-mcrypt
再度
$ composer install

Loading composer repositories with package information
Initializing PEAR repository http://pear.cakephp.org
Installing dependencies (including require-dev)
  - Installing cakephp/cakephp (2.6.1)
    Downloading: 100%         

Writing lock file
Generating autoload files

cakephpが入りました
こんなディレクトリで入るみたいです

$ tree -d -L 5

.
└── Vendor
    ├── bin
    ├── cakephp
    │   └── cakephp
    │       ├── app
    │       │   ├── Config
    │       │   ├── Console
    │       │   ├── Controller
    │       │   ├── Lib
    │       │   ├── Locale
    │       │   ├── Model
    │       │   ├── Plugin
    │       │   ├── Test
    │       │   ├── Vendor
    │       │   ├── View
    │       │   ├── tmp
    │       │   └── webroot
    │       ├── lib
    │       │   └── Cake
    │       ├── plugins
    │       └── vendors
    └── composer

エラーが出たら
http://book.cakephp.org/2.0/ja/getting-started.html
http://book.cakephp.org/2.0/ja/installation/url-rewriting.html
を参考に