Skip to content

Instantly share code, notes, and snippets.

@drupol
Last active February 14, 2024 08:23
Show Gist options
  • Save drupol/ab25340ea5fa46e3c2f49c1d9ed5eb71 to your computer and use it in GitHub Desktop.
Save drupol/ab25340ea5fa46e3c2f49c1d9ed5eb71 to your computer and use it in GitHub Desktop.
{
"name": "foo/bar",
"type": "library",
"description": "description",
"license": "MIT",
"require": {
"php": "^7.2.5 || ^8.0",
"composer/ca-bundle": "^1.0"
}
}
{
"_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#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d38fa81e71b11eba3532774fba66b5a7",
"packages": [
{
"name": "composer/ca-bundle",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "b66d11b7479109ab547f9405b97205640b17d385"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/b66d11b7479109ab547f9405b97205640b17d385",
"reference": "b66d11b7479109ab547f9405b97205640b17d385",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"ext-pcre": "*",
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.55",
"psr/log": "^1.0",
"symfony/phpunit-bridge": "^4.2 || ^5",
"symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\CaBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
"keywords": [
"cabundle",
"cacert",
"certificate",
"ssl",
"tls"
],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/ca-bundle/issues",
"source": "https://github.com/composer/ca-bundle/tree/1.4.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2023-12-18T12:05:55+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.2.5 || ^8.0"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
}
#!/bin/sh
# Exit on error
set -e
# To run this bash script, you need to have the following tools installed:
# php, composer, git
# Set the path to the composer executable (if not in PATH)
COMPOSER=composer
# We cleanup the leftovers from a previous run
rm -rf local-repo vendor composer.lock composer.json
mkdir local-repo
cp composer.json.orig composer.json
cp composer.lock.orig composer.lock
# Set composer to not use cache
export COMPOSER_CACHE_DIR=/dev/null
# Print composer version
$COMPOSER --version
# Validate the `composer.json` and its `composer.lock`
$COMPOSER validate --no-ansi --no-interaction --strict
# Build the local repository through the custom plugin in the directory `local-repo`
$COMPOSER build-local-repo --no-ansi --no-interaction local-repo
# Modify `composer.json`, to point to the local repository by default
$COMPOSER config repo.packagist false
$COMPOSER config repo.composer composer file://$(pwd)/local-repo/packages.json
# Prevent composer to access to network
export COMPOSER_DISABLE_NETWORK=1
# Set composer to copy files instead of making symlinks
export COMPOSER_MIRROR_PATH_REPOS=1
# Update the lock file only since we modify it
$COMPOSER \
--lock \
--no-ansi \
--no-install \
--no-interaction \
update
# Validate the `composer.json` and its `composer.lock`
$COMPOSER validate --no-ansi --no-interaction --strict
# Finally, create the `vendor` dir
$COMPOSER \
--no-ansi \
--no-interaction \
install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment