使用composer来安装php的相关框架,不需要事先准备composer.json以及conmposer.lock以及composer.phar等文件;

直接在项目根目录下是使用composer require frameworkname即可

使用composer require frameworkname命令执行以下动作:

(1)首先在项目根目录下生成composer.json文件

(2)会在项目更目录下生成框架的vendor目录,vendor目录即为框架,vendor目录会包含一个autoload.php文件用于加载框架;包含一个composer目录定义各种加载器

(3)最后生成composer.lock文件

例如在一个空目录下安装beanbun

生成的文件如下所示:

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": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
                "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": "mtdowling@gmail.com",
                    "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": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
                "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": "mtdowling@gmail.com",
                    "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": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
                "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": "mtdowling@gmail.com",
                    "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": "3b84c35de3470a3a2a44d47d201bdc3b7602e666"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/kiddyuchina/Beanbun/zipball/3b84c35de3470a3a2a44d47d201bdc3b7602e666",
                "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": "58631254@qq.com"
                }
            ],
            "description": "Beanbun 是用 PHP 编写的多进程网络爬虫框架,具有良好的开放性、高可扩展性",
            "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": "f6561bf28d520154e4b0ec72be95418abe6d9363"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
                "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": "cbc6e46deb9e1a82a5f628118c850ebeea7b2224"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/walkor/Workerman/zipball/cbc6e46deb9e1a82a5f628118c850ebeea7b2224",
                "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": "walkor@workerman.net",
                    "homepage": "http://www.workerman.net",
                    "role": "Developer"
                }
            ],
            "description": "An asynchronous event driven PHP framework for easily building fast, scalable network applications.",
            "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": []
}

使用composer安装php的相关框架的更多相关文章

  1. [视频教程] 使用composer安装使用thinkphp6.0框架

    安装composer -vvv的参数是表示展示安装进度,测试时使用其他参数安装失败,一直卡着不动curl -vvv https://getcomposer.org/installer | phpmv ...

  2. Composer安装Yii2以及相关扩展

    1.安装redis扩展 命令:composer require yiisoft/yii2-redis Git地址:https://github.com/yiisoft/yii2-redis/blob/ ...

  3. 使用 Composer 安装 Laravel 框架

    前言: 1. Composer 安装 Laravel 有两种方式: 第一种是通过 Composer 的 create-project 命令安装 Laravel 框架, 第二种是先通过 Composer ...

  4. Nutch相关框架安装使用最佳指南(转帖)

    Nutch相关框架安装使用最佳指南 Chinese installing and using instruction  -  The best guidance in installing and u ...

  5. windows环境下安装composer,然后使用composer安装Laravel

    Composer 不是一个包管理器,它仅仅是一个依赖管理工具,它允许你申明项目所依赖的代码库,并在你的项目中安装这些代码库.它涉及 “packages” 和 “libraries”,但它在每个项目的基 ...

  6. Nutch相关框架视频教程--说明

    PDF文档: Nutch大数据相关框架讲义.pdf Nutch1.7二次开发培训讲义.pdf Nutch1.7二次开发培训讲义之腾讯微博抓取分析 Nutch公开课从搜索引擎到网络爬虫 ======== ...

  7. Yii 通过composer 安装的方法

    Yii2框架可以通过两种方式 安装 : 第一种方法: Yii2有两个模板 一个是基础模板,一个是高级模板,基础可能简单点吧.........,现在直接从   https://github.com/yi ...

  8. Composer 安装(一)

    一.简介 Composer 是 PHP 用来管理依赖(dependency)关系的工具.你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会帮你安装这些依赖的库文件. ...

  9. composer安装yii2

    这几天准备入门yii2,但是对于一个看php不到5天的小白来说,只能说路途艰辛,不过,总算是解决了,先放一张大图 感受一下成功的喜悦...(文章最后有惊喜哦) ok,下面就描述一下安装的步骤: 1.安 ...

随机推荐

  1. Python -处理PDF

    处理pdf文档 第一. 从文本中提取文本 第二. 创建PDF 两种方法 #使用PdfFileWriter import PyPDF2 pdfFiles = [] for filename in os. ...

  2. 仿照wtform自定义Form组件

    仿照wtforms自定义Form组件 1.wtforms 点击查看源码分析及使用方法 2.自定义Form组件 #!usr/bin/env python # -*- coding:utf-8 -*- f ...

  3. StringRedisTemplate操作Redis

    在说到StringRedisTemplate操作Redis数据的时候,我们顺便谈谈StringRedisTemplate和RedisTemplate的区别. 一.StringRedisTemplate ...

  4. AI LeNet

    LeNet 参考链接: http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf https://www.charleychai.com/blogs/20 ...

  5. iis 网页HTTP 错误 404.3 - Not Found解决方案

    一. 1.依次打开控制面板→程序和功能→打开或关闭Windwos功能 2.在打开的Windows功能窗口中依次展开Internet信息服务→万维网服务→应用程序开发功能,将需要的功能选项前面的勾上,确 ...

  6. CentOS下安装Apache

    CentOS下安装Apache,首先在用户状态下使用su root命令切换到超级管理员界面,让后开启终端,进行apache的安装过程. [root@localhost centos]# yum ins ...

  7. 典型分布式系统分析:Bigtable

    本文是典型分布式系统分析的第三篇,分析的是Bigtable,一个结构化的分布式存储系统. Bigtable作为一个分布式存储系统,和其他分布式系统一样,需要保证可扩展.高可用与高性能.与此同时,Big ...

  8. ffmpeg源码安装

    官网下载地址 http://www.ffmpeg.org/download.html https://sourceforge.net/projects/opencore-amr/ 参考资料:官网及以下 ...

  9. HBase篇(1)-特性与应用场景

    [每日五分钟搞定大数据]系列,HBase第一篇 结束了Zookeeper篇, 接下来我们来说下Google三驾马车之一BigTable的开源实现:HBase,要讲的内容暂定如下: 这是第一篇我们先不聊 ...

  10. 开源后的.Net 如何选择使用

     .NET是跨平台的开发栈.它有一个标准库,称为.NET Standard Library,其中包含了大量的APIs.这个标准库由各种.NET运行环境实现:.NET Framework..NET Co ...