REMEMBER PHP

MINTE9
2REMEMBER




Last update:   23-07-2021

Github

Generate a new release on github Composer init generates composer.json file
 
New release:
Tag version: v1.2
Target: releases (branch)
 
cd dss-client/

composer init
 
{
    "name": "catalin/dss-client",
    "require": {}
}
... 1 more rows
˄˄˄

Repositories and package

By default Composer only uses the packagist repository. By specifying repositories you can get packages from elsewhere. Repositories are not resolved recursively. You can only add them to your main composer.json. Repository declarations of dependencies' composer.jsons are ignored.

composer json

Add private git repository and release version (+ autoload) Move index.php example to root
 
{
    "name": "catalin/dss-client",
    "require": {
        "minte9/httpclient": "1.0"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "minte9/httpclient",
                "version": "1.8",
                "source": {
                    "type": "git",
                    "url": "https://myusername@github.com/myusername/http-client.git",
                    "reference": "v1.8"
                }
            }
        }
    ],
    "autoload": {
        "psr-4": {
            "minte9\httpclient\": "vendor/minte9/httpclient/src/"
        }
    }
}
... 22 more rows
˄˄˄
 
composer require minte9/httpclient
 
vendor/
    composer/
    minte9/ 
        src/
        inc/
        index.example.php
        composer.example.json
    autoload/
... 5 more rows
˄˄˄
 
mv example.php /dss-client/index.php

Composer version caret

 
~1.2 is equivalent to >=1.2 <2.0.0, while ~1.2.3 is equivalent to >=1.2.3 <1.3.0

^1.2.3 is equivalent to >=1.2.3 <2.0.0

Questions    
No. 81   Generators
CARD
80
96

        A B C D E F
🔔
1/1