PROGRAMMING

  MINTE9
REMEMBERS




Last update:   29-10-2021

Github

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

composer init
 
{
    "name": "catalin/<span class='keyword_code'>dss-client</span>",
    "require": {}
}

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": <span class='keyword_code'>"1.8"</span>,
                "source": {
                    "type": "git",
                    "url": "https://<span class='keyword_code'>myusername</span>@github.com/myusername/http-client.git",
                    "reference": <span class='keyword_code'>"v1.8"</span>
                }
            }
        }
    ],
    "autoload": {
        "<span class='keyword_code'>psr-4</span>": {
            "minte9\httpclient\": "vendor/minte9/httpclient/src/"
        }
    }
}
 
composer require minte9/httpclient
 
vendor/
    composer/
    minte9/ 
        src/
        inc/
        index.example.php
        composer.example.json
    autoload/
 
mv example.php /dss-client/index.php

Composer version caret

 
<span class='keyword_code'>~1.2</span> is equivalent to >=1.2 <2.0.0, while ~1.2.3 is equivalent to >=1.2.3 <1.3.0

<span class='keyword_code'>^1.2.3</span> is equivalent to >=1.2.3 <2.0.0

Questions    
Generators
        A B C D E F
🔔
1/1