Using composer to install PHP's relevant framework

Source: Internet
Author: User
Tags autoload install php php framework

Use composer to install the relevant framework of PHP, do not need to prepare Composer.json and Conmposer.lock and Composer.phar and other documents;

Directly under the project root, you can use the composer require frameworkname

Use the composer require frameworkname command to perform the following actions:

(1) First generate the Composer.json file in the project root directory

(2) The Vendor directory of the framework is generated in the project directory, the vendor directory is the framework, and the vendor directory contains a autoload.php file for loading the framework; A composer catalog defines various loaders

(3) Finally generate the Composer.lock file

For example, install Beanbun in an empty directory

The resulting file is as follows:

Composer.json

{    "require": {        "Kiddyu/beanbun": "^1.0"    }}

autoload.php

<? PHP // autoload.php @generated by Composer require_once __dir__. '/composer/autoload_real.php '; return Composerautoloaderinitf0360927d4c8cd5f4c7318db461c5f92::getloader ();

Composer.lock

{    "_readme": [        "This file locks the dependencies of your project to a known state", "Read more about it at https://getcomposer.org /doc/01-basic-usage.md#composer-lock-the-lock-file "," This file is @generated automatically "    ], "Content-hash": "f39f11ea038520d38d9236d063973569", "packages": [        {            "Name": "Guzzlehttp/guzzle", "Version": "6.3.3", "source": {                "Type": "Git", "url": "Https://github.com/guzzle/guzzle.git", "Reference": "407b0cb880ace85c 9b63c5f9551db498cb2d50ba "            }, "Dist": {                "Type": "Zip", "url": "Https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498c B2d50ba "," Reference ":" 407b0cb880ace85c9b63c5f9551db498cb2d50ba "," Shasum ":" "            }, "Require": {                "Guzzlehttp/promises": "^1.0", "GUZZLEHTTP/PSR7": "^1.4", "PHP": ">=5.5"            }, "Require-dev": {                "Ext-curl": "*", "Phpunit/phpunit": "^4.8.35 | | ^5.7 | | ^6.4 | | ^7.0 "," Psr/log ":" ^1.0 "            }, "Suggest": {                "Psr/log": "Required for using the log middleware"            }, "type": "Library", "Extra": {                "Branch-alias": {                    "Dev-master": "6.3-dev"                }            }, "AutoLoad": {                "Files": [                    "Src/functions_include.php"                ], "psr-4": {                    "guzzlehttp\\": "src/"                }            }, "Notification-url": "https://packagist.org/downloads/", "license": [                "MIT"            ], "authors": [                {                    "Name": "Michael Dowling", "email": "[email protected]", "homepage": "Https://github . com/mtdowling "                }            ], "description": "Guzzle is a PHP HTTP client library", "homepage": "http://guzzlephp.org/", "keywords": [                "Client", "curl", "framework", "http", "HTTP Client", "Rest", "Web Service"            ], "Time": "2018-04-22t15:46:56+00:00"        },        {            "Name": "Guzzlehttp/promises", "Version": "v1.3.1", "source": {                "Type": "Git", "url": "Https://github.com/guzzle/promises.git", "Reference": "a59da6cf61d800 60647ff4d3eb2c03a2bc694646 "            }, "Dist": {                "Type": "Zip", "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a 2bc694646 "," Reference ":" a59da6cf61d80060647ff4d3eb2c03a2bc694646 "," Shasum ":" "            }, "Require": {                "PHP": ">=5.5.0"            }, "Require-dev": {                "Phpunit/phpunit": "^4.0"            }, "type": "Library", "Extra": {                "Branch-alias": {                    "Dev-master": "1.4-dev"                }            }, "AutoLoad": {                "Psr-4": {                    "guzzlehttp\\promise\\": "src/"                }, "Files": [                    "Src/functions_include.php"                ]            }, "Notification-url": "https://packagist.org/downloads/", "license": [                "MIT"            ], "authors": [                {                    "Name": "Michael Dowling", "email": "[email protected]", "homepage": "Https://github . com/mtdowling "                }            ], "description": "Guzzle promises library", "keywords": [                "Promise"            ], "Time": "2016-12-20t10:07:11+00:00"        },        {            "Name": "Guzzlehttp/psr7", "Version": "1.4.2", "source": {                "Type": "Git", "url": "Https://github.com/guzzle/psr7.git", "Reference": "f5b8a8512e2b58b007 1a7280e39f14f72e05d87c "            }, "Dist": {                "Type": "Zip", "url": "Https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e0 5d87c "," Reference ":" f5b8a8512e2b58b0071a7280e39f14f72e05d87c "," Shasum ":" "            }, "Require": {                "PHP": ">=5.4.0", "Psr/http-message": "~1.0"            }, "Provide": {                "Psr/http-message-implementation": "1.0"            }, "Require-dev": {                "Phpunit/phpunit": "~4.0"            }, "type": "Library", "Extra": {                "Branch-alias": {                    "Dev-master": "1.4-dev"                }            }, "AutoLoad": {                "Psr-4": {                    "guzzlehttp\\psr7\\": "src/"                }, "Files": [                    "Src/functions_include.php"                ]            }, "Notification-url": "https://packagist.org/downloads/", "license": [                "MIT"            ], "authors": [                {                    "Name": "Michael Dowling", "email": "[email protected]", "homepage": "Https://github . com/mtdowling "                },                {                    "Name": "Tobias Schultze", "homepage": "Https://github.com/Tobion"                }            ], "description": "PSR-7 message implementation that also provides common utility methods", "keywords ": [                "http", "message", "Request", "response", "stream", "uri", "url"            ], "Time": "2017-03-20t17:10:46+00:00"        },        {            "Name": "Kiddyu/beanbun", "Version": "1.0.4", "source": {                "Type": "Git", "url": "Https://github.com/kiddyuchina/Beanbun.git", "Reference": "3b84c35de3 470a3a2a44d47d201bdc3b7602e666 "            }, "Dist": {                "Type": "Zip", "url": "https://api.github.com/repos/kiddyuchina/Beanbun/zipball/3b84c35de3470a3a2a44d47d201 bdc3b7602e666 "," Reference ":" 3b84c35de3470a3a2a44d47d201bdc3b7602e666 "," Shasum ":" "            }, "Require": {                "Guzzlehttp/guzzle": "^6.0", "PHP": ">=5.5.0", "Workerman/workerman": "^3.3"            }, "type": "Application", "AutoLoad": {                "Psr-4": {                    "beanbun\\": "src/"                }            }, "Notification-url": "https://packagist.org/downloads/", "license": [                "MIT"            ], "authors": [                {                    "Name": "Kidd Yu", "email": "[email protected]"                }            ], "description": "Beanbun is a multi-process web crawler framework written in PHP, with good openness, high scalability", "keywords": [                "Crawler", "scraper", "spider"            ], "Time": "2017-06-11t17:13:59+00:00"        },        {            "Name": "Psr/http-message", "Version": "1.0.1", "source": {                "Type": "Git", "url": "Https://github.com/php-fig/http-message.git", "Reference": "F6561bf28 d520154e4b0ec72be95418abe6d9363 "            }, "Dist": {                "Type": "Zip", "url": "Https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be 95418abe6d9363 "," Reference ":" f6561bf28d520154e4b0ec72be95418abe6d9363 "," Shasum ":" "            }, "Require": {                "PHP": ">=5.3.0"            }, "type": "Library", "Extra": {                "Branch-alias": {                    "Dev-master": "1.0.x-dev"                }            }, "AutoLoad": {                "Psr-4": {                    "psr\\http\\message\\": "src/"                }            }, "Notification-url": "https://packagist.org/downloads/", "license": [                "MIT"            ], "authors": [                {                    "Name": "Php-fig", "homepage": "http://www.php-fig.org/"                }            ], "description": "Common Interface for HTTP messages", "homepage": "https://github.com/php-fig/http- Message "," keywords ": [                "http", "Http-message", "PSR", "psr-7", "Request", "Response"            ], "Time": "2016-08-06t14:39:51+00:00"        },        {            "Name": "Workerman/workerman", "Version": "v3.5.8", "source": {                "Type": "Git", "url": "Https://github.com/walkor/Workerman.git", "Reference": "Cbc6e46deb9e1 a82a5f628118c850ebeea7b2224 "            }, "Dist": {                "Type": "Zip", "url": "https://api.github.com/repos/walkor/Workerman/zipball/cbc6e46deb9e1a82a5f628118c850e beea7b2224 "," Reference ":" cbc6e46deb9e1a82a5f628118c850ebeea7b2224 "," Shasum ":" "            }, "Require": {                "PHP": ">=5.3"            }, "Suggest": {                "Ext-event": "For better performance."            }, "type": "Library", "AutoLoad": {                "Psr-4": {                    "workerman\\": "./"                }            }, "Notification-url": "https://packagist.org/downloads/", "license": [                "MIT"            ], "authors": [                {                    "Name": "Walkor", "email": "[email protected]", "homepage": "Http://www.workerman.ne T "," Role ":" Developer "                }            ], "description": "An asynchronous event driven PHP framework for easily building fast, scalable network Applica tions. "," homepage ":" http://www.workerman.net "," keywords ": [                "Asynchronous", "Event-loop"            ], "Time": "2018-05-23t05:36:47+00:00"        }    ], "Packages-dev": [], "aliases": [], "minimum-stability": "Stable", "stability-flags": [], "prefer-stable":false, "Prefer-lowest":false, "platform": [], "Platform-dev": []}

Using composer to install PHP's relevant framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.