2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

laminas-migrationを試す

Last updated at Posted at 2020-10-17

zendframeworkのバージョン2,3に使用できるらしいので、使い方を試した結果を忘れないようにメモしておこう。

準備

コンポーザをインストールしておく
適当な階層でコマンド実行
# curl -sS https://getcomposer.org/installer | php

composer.pharが作成されるので、どこからでも使えるように移動しておく(しなくてもいい)
# mv composer.phar /usr/local/bin/composer

マイグレーションツールの実験用として、zendバージョン2のサンプルを用意しておく

https://github.com/zendframework/zf2-tutorial
サイトからgit cloneで取得できるが、今回はzipのURLを使ってwgetで取得。
適当な場所に配置して解凍。フォルダ内に移動してインストール実施

# cd <解凍したフォルダ>
# composer install

マイグレーションツールインストール

ラミナスのドキュメントを参考にして作業を進める。
https://docs.laminas.dev/migration/

[root@localhost test]# # composer global require laminas/laminas-migration

インストールされた場所を確認する
[root@localhost test]# composer global config home
Changed current directory to /root/.config/composer
/root/.config/composer
[root@localhost test]#

laminas/laminas-migrationの実態は、/root/.config/composerフォルダ内にあるとわかった。

/usr/local/bin/への配置・・・というか、そこから実態へのシンボリックリンクをはると使い勝手が良くなるはずだが、しなくても良いので省略。

README.mdによると実行コマンドはこれ。[path]がマイグレーションしたいシステムのパスになる
$ laminas-migration migrate [--no-plugin] [--exclude=|-e=] [--keep-locked-versions] [path]

移動
# cd /root/.config/composer/vendor/laminas/laminas-migration/bin
実行
# php laminas-migration migrate 解凍しておいたzf2-tutorialのパス

実行結果

  • 検証用のzf2-tutorial/配下から、vendorフォルダがまるごと削除された
  • module等のソースから、Zend\の記述がLaminas\に置き換わってる
  • composer.jsonの中身がlaminasのものに置き換わっている

たぶん、このあとラミナスをインストールすればいいのか。

移動
# cd 検証用のzf2-tutorial/
インストール
#  composer install

実行すると失敗。

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laminas/laminas-test 3.4.2 requires phpunit/phpunit ^4.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, 7.5.2, 7.5.20, 7.5.3, 7.5.4, 7.5.5, 7.5.6, 7.5.7, 7.5.8, 7.5.9, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.1.0, 8.1.1, 8.1.2, 8.1.3, 8.1.4, 8.1.5, 8.1.6, 8.2.0, 8.2.1, 8.2.2, 8.2.3, 8.2.4, 8.2.5, 8.3.0, 8.3.1, 8.3.2, 8.3.3, 8.3.4, 8.3.5, 8.4.0, 8.4.1, 8.4.2, 8.4.3, 8.5.0, 8.5.1, 8.5.2, 8.5.3, 8.5.4, 8.5.5, 8.5.6, 8.5.7, 8.5.8, 8.5.x-dev, 9.0.0, 9.0.1, 9.0.2, 9.1.0, 9.1.1, 9.1.2, 9.1.3, 9.1.4, 9.1.5, 9.2.0, 9.2.1, 9.2.2, 9.2.3, 9.2.4, 9.2.5, 9.2.6, 9.3.0, 9.3.1, 9.3.10, 9.3.11, 9.3.2, 9.3.3, 9.3.4, 9.3.5, 9.3.6, 9.3.7, 9.3.8, 9.3.9, 9.4.0, 9.4.1, 9.4.x-dev, 9.5.x-dev] but these conflict with your requirements or minimum-stability.
(略)

composer.jsonの66行目 "laminas/laminas-test": "^3.0.1", を削除して再実行。
するとインストールに成功し、vendorフォルダが作成された。

しかしこの後画面を確認するとFatal error…。
やっぱりマイグレツールを実施した後も、手直しが必要なのか…
zendframeworkバージョン2とバージョン3の間にも違いがあるらしいので、当然と言えば当然か・・・。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?