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

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

cakephp 3を試してみる

php 7入のUbuntuで、cakephp 3を試してみました
Quick Start Guide

php のバージョンをチェック

$ php -v
PHP 7.0.7-4+deb.sury.org~trusty+1 (cli) ( NTS )

さっそくいれてみる

$ composer create-project –prefer-dist cakephp/app bookmarker

エラー..

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - cakephp/cakephp 3.2.9 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.8 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.7 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.6 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.5 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.4 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.3 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.11 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.10 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/cakephp 3.2.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - Installation request for cakephp/cakephp ~3.2 -> satisfiable by cakephp/cakephp[3.2.0, 3.2.1, 3.2.10, 3.2.11, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.2.8, 3.2.9].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-apcu.ini
    - /etc/php/7.0/cli/conf.d/20-apcu_bc.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-newrelic.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.0/cli/conf.d/20-xdebug.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

PHP extension intl がないようなので入れます

$ sudo apt-get update
$ sudo apt-get php7.0-intl

念の為もう一度いれておきます

$ rm -rf bookmarker/
$ composer create-project –prefer-dist cakephp/app bookmarker

最後のほうのログがこんな感じ

cakephp/app suggests installing phpunit/phpunit (Allows automated tests to be run without system-wide install.)
cakephp/app suggests installing cakephp/cakephp-codesniffer (Allows to check the code against the coding standards used in CakePHP.)
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/process ()
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
cakephp/debug_kit suggests installing ext-sqlite (DebugKit needs to store panel data in a database. SQLite is simple and easy to use.)
Writing lock file
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump
> App\Console\Installer::postInstall
Created `config/app.php` file
Set Folder Permissions ? (Default to Y) [Y,n]? Y
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/cache
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/cache/models
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/cache/persistent
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/cache/views
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/sessions
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp/tests
Permissions set on /home/user/ws/cakephp3/bookmarker/tmp
Permissions set on /home/user/ws/cakephp3/bookmarker/logs
Updated Security.salt value in config/app.php

これでインストールできました
試しに起動

$ bin/cake server -H sample.com -p port

sample.com と port はご自由に
指定しない場合
localhost:8765で立ち上がるようです

起動した画面
https://gyazo.com/86a9ea1a19572c0b82068cd6720dad74

mysqlとつなぎます

ログイン

$ mysql -u user -ppassword

userとpasswordはご自身のもので

データベース作成
mysql> create database cake_bookmarks character set utf8;

データベース指定して
mysql> connect cake_bookmarks;

Quick Start Guide
のsqlを流します

テーブルまでできあがり

cakephpにデータベースの設定を書きます

$ vim config/app.php

で Datasources のところの設定を書き換えます
これでつながりました

ここまででベースができあがり