码迷,mamicode.com
首页 > 其他好文 > 详细

composer 创建自己包

时间:2018-10-02 17:13:52      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:git push   efi   rar   empty   描述   visit   标签   ranch   license   

服务器环境下创建自己的项目文件

技术分享图片

 

初始化composer

打开cmd 窗口,cd 到 backrestore 执行 composer init 命令

D:\phpStudy\WWW\backrestore>composer init
Welcome to the Composer config generator This command will guide you through creating your composer.json config. Package name (
<vendor>/<name>) [administrator/backrestore]: xue-y/backrestore Description []: mysql Backup and restore // 项目描述可以不写 Author [xue-y <1922527784@qq.com>, n to skip]:
// 这里跳过使用默认 Minimum Stability []: Package Type (e.g. library, project, metapackage, composer-plugin) []: License []: // 这个可以不填 Define your dependencies. Would you like to define your dependencies (require) interactively [yes]? y Search for a package: Would you like to define your dev dependencies (require-dev) interactively [yes]? y Search for a package: { "name": "xue-y/backrestore", "description": "mysql Backup and restore", "authors": [ { "name": "xue-y", "email": "1922527784@qq.com" } ], "require": {} } Do you confirm generation [yes]? y

这里完成composer 初始化工作,自动生成一下文件

技术分享图片

编辑composer.json 文件

{
    "repositories": {     // 更改镜像源,国外的太慢
        "packagist": {
            "type": "composer",
            "url": "https://packagist.phpcomposer.com"
        }
    },
    "name": "xue-y/backrestore",
    "description": "mysql Backup and restore",
    "license": "Apache-2.0",
    "minimum-stability":"stable",
    "authors": [
        {
            "name": "xue-y",
            "email": "1922527784@qq.com"
        }
    ],
    "require": {
        "php": ">=5.0"
    },
    "autoload": {   // 添加自动加载
        "psr-4": {
            "backup\\": "backup/",
            "import\\": "import/"
        }
    }
}

执行 composer install 

D:\phpStudy\WWW\backrestore>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files

 

测试文件

技术分享图片

 

创建git 仓库

 技术分享图片

创建后会跳转到下面这个页面,根据你的需要按命令操作

技术分享图片

 

项目提交git

我这个项目现在不是一个存储库,所有先执行了一下 git init 初始化仓库

Administrator@Admin MINGW64 /d/phpStudy/WWW/backrestore
$ git init
Initialized empty Git repository in D:/phpStudy/WWW/backrestore/.git/

Administrator@Admin MINGW64 /d/phpStudy/WWW/backrestore (master)
$ git add README.md
Administrator@Admin MINGW64
/d/phpStudy/WWW/backrestore (master) $ git commit -m 添加第一个测试文件 [master (root-commit) d79b36b] 添加第一个测试文件 1 file changed, 76 insertions(+) create mode 100644 README.md
Administrator@Admin MINGW64
/d/phpStudy/WWW/backrestore (master) $ git remote add origin https://github.com/xue-y/backrestore.git Administrator@Admin MINGW64 /d/phpStudy/WWW/backrestore (master) $ git push -u origin master Counting objects: 3, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 1.57 KiB | 1.57 MiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: remote: Create a pull request for master on GitHub by visiting: remote: https://github.com/xue-y/backrestore/pull/new/master remote: To https://github.com/xue-y/backrestore.git * [new branch] master -> master Branch master set up to track remote branch master from origin.

 添加标签

技术分享图片

 

composer 创建自己包

标签:git push   efi   rar   empty   描述   visit   标签   ranch   license   

原文地址:https://www.cnblogs.com/xuey/p/9734930.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!