真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

怎么用composer開發(fā)自己的php擴展包-創(chuàng)新互聯(lián)

小編給大家分享一下怎么用composer開發(fā)自己的php擴展包,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站設(shè)計制作、成都做網(wǎng)站、革吉網(wǎng)絡(luò)推廣、微信小程序開發(fā)、革吉網(wǎng)絡(luò)營銷、革吉企業(yè)策劃、革吉品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們大的嘉獎;創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供革吉建站搭建服務(wù),24小時服務(wù)熱線:18980820575,官方網(wǎng)址:www.cdcxhl.com

composer 是PHP用來管理依賴關(guān)系的工具

開發(fā)流程

初始化自己的擴展包 composer init

$ composer init
  Welcome to the Composer config generator
  
This command will guide you through creating your composer.json config.
Package name (/) [administrator/self_composer]: victor/composer-self //包名稱-不能大寫,否則無效 
Description []: composer-self package //描述
Author [victor24680 <490319148@qq.com>, n to skip]://作者
Minimum Stability []: dev //最小穩(wěn)定版本
Package Type (e.g. library, project, metapackage, composer-plugin) []: library //類型
License []: MIT
Define your dependencies.
Would you like to define your dependencies (require) interactively [yes]? n //是否定義依賴關(guān)系
Would you like to define your dev dependencies (require-dev) interactively [yes]? n
{
    "name": "victor/composer-self",
    "description": "This is a composer-send package",
    "type": "victor",
    "license": "MIT",
    "authors": [
        {
            "name": "victor24680",
            "email": "490319148@qq.com"
        }
    ],
    "minimum-stability": "dev",
    "require": {}
}
Do you confirm generation [yes]? yes

修改自己包的依賴關(guān)系,修改內(nèi)容如下

{
    "name": "victor/sendtool-package",
    "description": "sendtool package",
    "type": "victor",
    "license": "MIT",
    "authors": [
        {
            "name": "victor24680",
            "email": "490319148@qq.com"
        }
    ],
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.6" //php版本要求
    },
    "autoload": {
        "psr-4": { //加載規(guī)范
            "App\\": "src/App",
            "Contract\\": "src/Contract"
        }
    }
}

編寫好源碼 見:https://github.com/victor24680/self-composer/tree/master/src

安裝測試 composer install

$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Content-Length mismatch, received 37487 bytes out of the expected 2005372
/tupian/20230522/ could not be fully loaded, package information was loaded from the local cache and may be out of date
Nothing to install or update
Writing lock file
Generating autoload files

GitHub上創(chuàng)建composer-self倉庫

git init
git add .
git commit -m "初始自己的組件庫"
git remote add origin https://github.com/victor24680/self-composer.git
git push origin master

Packagist 上提交自己的github創(chuàng)建的composer-self倉庫地址

注冊地址:https://packagist.org/,提交成功之后,就可以開始下面的測試

測試 ,A目錄代表項目根目錄

創(chuàng)建一個A目錄,然后在項目根目錄下執(zhí)行:composer require victor24680/self-composer dev-master

$ composer require victor24680/self-composer dev-master
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing victor24680/self-composer (dev-master 0935c75): Cloning 0935c75eda from cache
Writing lock file
Generating autoload files
msg('小明','隔壁老王在偷吃?。。?#39;);
//輸出:【站內(nèi)消息】發(fā)送給:小明|發(fā)送內(nèi)容:【普通消息】隔壁老王在偷吃?。。?/pre>

以上是“怎么用composer開發(fā)自己的php擴展包”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!


網(wǎng)頁名稱:怎么用composer開發(fā)自己的php擴展包-創(chuàng)新互聯(lián)
網(wǎng)站鏈接:http://weahome.cn/article/deehhj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部