How to install Zend Framework 2 Tool with composer

前端 未结 2 1203
渐次进展
渐次进展 2021-01-12 18:03

I can\'t figure out how to run zf.php (Zend Framework 2 Tool) when bootstrapped with composer.

First I bootstrap composer and zftool according to the documentation:<

相关标签:
2条回答
  • 2021-01-12 18:19

    You should copy zf.php into your root directory and run it from there.

    $ mkdir tmp && cd tmp
    $ curl -s https://getcomposer.org/installer | php
    $ ./composer.phar require zendframework/zftool:dev-master
    $ cp vendor/zendframework/zftool/zf.php .
    $ php zf.php
    
    0 讨论(0)
  • 2021-01-12 18:24

    Install Composer.phar locally

    If you do not have the composer globally installed on your machine, you can install it locally in the project.

    Installing Composer locally is a matter of just running the installer in your project directory (https://getcomposer.org/doc/00-intro.md).

    curl -sS https://getcomposer.org/installer | php
    

    Note: If the above fails for some reason, you can download the installer with php instead:

    php -r "readfile('https://getcomposer.org/installer');" | php
    

    Install ZF2

    git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive
    cd ZendSkeletonApplication
    php composer.phar self-update
    php composer.phar install
    

    Install ZFTools (Installation using Composer)

    php composer.phar require zendframework/zftool:dev-master
    php composer.phar install
    

    Create a symbolic link

    zf.php (Zend Tool) will be installed in the vendor/bin folder. You may run it with php vendor/bin/zf.php.

    ln -s vendor/zendframework/zftool/zf2.bat zftools
    chmod +x zftools
    ./zftools
    

    In this case, I prefer symbolic link, for updating the zftools repository, I do not need to copy the file again.

    Without installation, using the PHAR file

    Another alternative to using the ZF tools, without creating scripts or aliases, and download the PHAR format.

    wget https://packages.zendframework.com/zftool.phar --no-check-certificate
    php zftool.phar  version
    ZFTool - Zend Framework 2 command line Tool
    The ZFTool is using Zend Framework 2.2.4
    

    Or you can download zftool.phar and use it.

    Note 1:The @akond response is very good, I'm just presenting an alternative answer I like to use.

    Note 2: This example was done on a windows machine using cygwin.

    Good tutorial installation (ZF2 and ZF3)

    Getting started: A skeleton application

    Ref:

    Zend Framework Tool (ZFTool)

    0 讨论(0)
提交回复
热议问题