One repository my composer.json now empty or private I still wanted to use this composer.json how i add new repository - json

this is my composer.json
{
"name": "mountain-code/symfony-sonata-media-admin",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/sidz/SonataMediaBundle.git",
"no-api": true
}
],
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"sensio/generator-bundle": "~2.3",
"sonata-project/admin-bundle": "~2.3",
"sonata-project/doctrine-orm-admin-bundle": "~2.3",
"sonata-project/user-bundle": "^2.2",
"doctrine/doctrine-fixtures-bundle": "^2.3",
"sonata-project/media-bundle": "2.3.x-dev",
"tilleuls/ckeditor-sonata-media-bundle": "^1.0",
"egeloen/ckeditor-bundle": "^4.0",
"knplabs/knp-menu-bundle": "~1.1",
"payum/payum-bundle": "^2.1",
"php-http/guzzle6-adapter": "^1.1",
"payum/paypal-express-checkout-nvp": "^1.3",
"payum/offline": "^1.3",
"hwi/oauth-bundle": "^0.5.1"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "5.5.9"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
}
}
now
"repositories": [
{
"type": "vcs",
"url": "https://github.com/sidz/SonataMediaBundle.git",
it s empty
But I still wanted to use this composer.json by adding another adcalendar repository
But when I make require adesigns / calendar-bundle no download for empty or private repository (https://github.com/sidz/SonataMediaBundle.git), as I can do thanks

You are out of luck. You referenced other peoples stuff in a way that specifically worked around their decision to NOT publish their work for the general public to consume. You didn't fork their repo or stored their work as a backup in any other way. And now it is gone.
The only thing that hopefully is left is the current state of the vendor/sidz/SonataMediaBundle directory with the last version that you were able to download before the deletion. You could start a new repository and commit this state into it and tag it with the same version, then switch the reference to this new repository. Composer only works by package name - if the name does not change (it is defined in the composer.json file you already have), and the version does not change, Composer consideres this package to be the same, even if the source URL is different.
You could also revert your dependency to be on the original package that is still maintained: https://packagist.org/packages/sonata-project/media-bundle I don't know how much has to change in your code in order to make that work, but I'd strongly suggest to go that route because otherwise you have to maintain that unofficial package yourself.

Related

Laravel 9 Composer Require Failed = Your requirements could not be resolved to an installable set of packages

I apologize in advance because I have created a thread with a similar title to another thread. I had to do this because I couldn't find a way to fix this.
So, I want to make my website auto reload/refresh using the Laravel Serve LiveReload by Bangnokia library (src: https://github.com/bangnokia/laravel-serve-livereload) following the tutorial from Gubug IT's yt channel (src: https: //www.youtube.com/watch?v=ZJ7m6fWNW0E).
Well, when I install composer require bangnokia/laravel-serve-livereload --dev on laravel 9, an error appears like the photo below. maybe colleagues have a solution to fix this or suggest a solution with another method. please help me, thank you..
error picture
my composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"anhskohbo/no-captcha": "^3.4",
"google/recaptcha": "^1.2",
"guzzlehttp/guzzle": "^7.2",
"laravel-lang/lang": "~3.0",
"laravel/framework": "^9.2",
"laravel/sanctum": "^2.14.1",
"laravel/socialite": "^5.5",
"laravel/tinker": "^2.7",
"laravel/ui": "^3.4",
"realrashid/sweet-alert": "^5.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-update-cmd": [
"#php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
This package is daed, please use the new Vite integrated instead.
https://laravel.com/docs/9.x/vite#blade-refreshing-on-save

"UnexpectedValueException" on yii2 composer update

Got "UnexpectedValueException" Your github oauth token for github.com contains invalid characters:"" while composer update on yii2 project.
When i was installing jui datetimepicker via composer, I have asked to give git token to install it. I had generated the token from GitLab and provide the token to terminal.I also change the composer.json file with token. But it gives me an error of "UnexpectedValueException" Your github oauth token for github.com contains invalid characters.
I have tried following solutions :
1) I have deleted my .git folder and tried to update composer still same issue
2) I have deleted the vendor and reinstall the composer not worked.
3) I have deleted the vendor and composer.json and put the previous vendor and composer.json file from my backup. but still get same issue.
4) I have tried to change the token from the following code :
composer config --global github-oauth.github.com <TOKEN>
5) Also put the following code in composer.json :
{
"config": {
"github-oauth": {
"github.com": "<TOKEN>"
}
}
}
Still same issue.
My composer.json file is as follows :
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Application Template",
"keywords": ["yii2", "framework", "advanced", "application template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"claudejanz/yii2-mygii": "dev-master",
"bower-asset/jquery": "#stable",
"bower-asset/jquery.inputmask": "#stable",
"bower-asset/punycode": "#stable",
"bower-asset/bootstrap": "#stable",
"3ch3r46/bootui-datepicker": "1.0.0",
"yiisoft/yii2-jui": "*",
"udokmeci/yii2-phone-validator" : "dev-master"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*"
},
"suggest": {
"codeception/codeception": "Codeception, 2.0.* is currently works well with Yii.",
"codeception/specify": "BDD style code blocks for PHPUnit and Codeception",
"codeception/verify": "BDD Assertions for PHPUnit and Codeception",
"yiisoft/yii2-faker": "Fixtures generator for Yii2 based on Faker lib"
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::setPermission"
]
},
"config": {
"process-timeout": 1800
},
"extra": {
"writable": [
"backend/runtime",
"backend/web/assets",
"frontend/runtime",
"frontend/web/assets"
],
"executable": [
"yii"
],
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
Please someone help.
I'm not sure what was the reason why it stopped working for you but as we discussed in comments the solution was to update the entry in auth.json that stores this GitHub token.
For everyone looking for this solution - auth.json is stored in your COMPOSER_HOME path. You can find this path by calling in the console
composer config -g data-dir
For more information about Composer configuration please refer to the Composer documentation at getcomposer.org.

Load composer package from private gitlab

In my composer setup I load packages from 2 repos. One composer repo and a private gitlab repo. When I try to do a composer install on my local windows machine, I get the following error messages:
GitLab: The project you were looking for could not be found. fatal:
Could not read from remote repository. Please make sure you have the
correct access rights and the repository exists. ... The requested
package sv-test/testextension could not be found in any version, there
may be a typo in the package name.
Authentification is done via lokal ssh-key and password, that doesnt seem to be the problem. Whats wrong with my setup?
The composer.json of the project looks like this:
{
"repositories": [
{
"type": "composer",
"url": "https://composer.typo3.org/"
},
{
"type": "git",
"url": "git#gitlab.xydevbox.de:sv-test/Testproject.git"
}
],
"name": "svdev/master-dev-box",
"description": "",
"type": "project",
"license": "MIT",
"homepage": "https://www.xydevbox.de/",
"authors": [
{
"name": "Sacha Vorbeck",
"email": "sacha.vorbeck#xydevbox.de",
"homepage": "https://www.xydevbox.de/",
"role": "Developer"
}
],
"require": {
"sv-testbox/testextension": "*",
"helhum/typo3-console": "^4.5",
"typo3/cms": "^8.7"
},
"config": {
"sort-packages": true,
"process-timeout": 2000,
"preferred-install": {
"typo3/cms": "source",
"*": "dist"
}
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
}
}
}
The composer.json from the package to be included from the gitlab private repo looks like this:
{
"name": "sv-testbox/testextension",
"type": "typo3-cms-extension",
"description": "",
"homepage": "https://www.xydevbox.de/",
"license": ["GPL-2.0+"],
"keywords": ["TYPO3 CMS"],
"version": "master",
"dist": {
"url": "git#gitlab.xydevbox.de:sv-test/Testproject.git",
"type": "git"
}
}
Maybe the latest composer version 1.5.2 is something for you if you take a look at the release notes
Fixed GitLabDriver looping endlessly in some conditions
Fixed
GitLabDriver support for unauthenticated requests
Fixed GitLab zip
downloads not triggering credentials prompt if unauthenticated
Fixed
path repository support of COMPOSER_ROOT_VERSION, it now applies to
all path repos within the same git repository
Fixed path repository
handling of copies to avoid copying VCS files and others
Fixed
sub-directory call to ignore list and create-project commands as well
as calls to Composer using --working-dir
Fixed invalid warning
appearing when calling remove on an non-stable package
https://github.com/composer/composer/releases
Thank you Georg and NextThursday. With some help on TYPO3 slack I finally got it running. The replace part was missing. I also learned that one should not edit composer.json files manually - always use the command line options to modify it. This example: https://github.com/TYPO3-Console/TYPO3-Console/blob/master/composer.json was also helpful.
project composer.json:
{
"repositories": [
{
"type": "composer",
"url": "https://composer.typo3.org/"
},
{
"type": "vcs",
"url": "https://github.com/svorbeck/masterconfig"
}
],
"name": "svorbeck/demo",
"description": "",
"type": "project",
"license": "MIT",
"homepage": "https://xydevbox.de/",
"authors": [
{
"name": "Sacha Vorbeck",
"email": "sacha.vorbeck#xydevbox.de",
"role": "Developer"
}
],
"require": {
"svorbeck/masterconfig": "dev-master",
"typo3/cms": "^8.7"
},
"config": {
"sort-packages": true,
"process-timeout": 2000,
"preferred-install": {
"typo3/cms": "source",
"svorbeck/masterconfig": "source",
"*": "dist"
}
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
},
"helhum/typo3-console": {
"install-extension-dummy": "0"
}
}
}
ext composer.json:
{
"name": "svorbeck/masterconfig",
"type": "typo3-cms-extension",
"description": "svorbeck master configuration",
"require": {
"typo3/cms-core": "^8.7"
},
"replace": {
"masterconfig": "self.version",
"svorbeck/masterconfig": "self.version"
}
}

How to modify composer.json for installing Gedmo Doctrine2 extensions in Symfony2

I'm trying to install to install the Gedmo Doctrine2 extensions in Symfony2 to use the translate composante.
I found a page online that show me how to do it (https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/symfony2.md), but I'm not shure about a few things.
First, when I change the composer.json file, I noticed that I have
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
And the instruction tells me to add
"psr-0": {
"Acme": "src/"
}
I don't know if I need to change the "": "src/", ligne or if I add the new ligne, or if I just let it be like it is.
I would really help me if someone juste tell what my file should looks like, so here is my composer.json:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0,>=3.0.12",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"sensio/generator-bundle": "2.0.*",
"jms/security-extra-bundle": "1.0.*",
"gedmo/doctrine-extensions": "dev-master",
"incenteev/composer-parameter-handler": "~2.0",
"ircmaxell/password-compat": "^1.0"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.6-dev"
}
}
}
The other thing is that after that step, I need to run php composer.phar update gedmo/doctrine-extensions in composer, but I don't have a a composer.phar file, so I did insted composer update.
Is that O.K., or I need to do an other line?
You can simply use
composer require gedmo/doctrine-extensions
and the composer.json will be automatically modified.
Regarding "composer" vs "composer.phar": yes, they are the same, so you can use whatever you have.
To add more details: usually everyone rename "composer.phar" to "composer" and move it to a binaries location on the os (i.e. /usr/local/bin on Linux) so that it can be used as a common system command. That is probably your situation.
The instruction is unclear, you do not need to change the line
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
Just add "gedmo/doctrine-extensions": "dev-master" to the require section.
Then to run a composer update you should install composer if you have not yet done so (but if you have symfony installed, I think you do unless you followed the instructions in the tutorial in which case I would reinstall symfony the official way as the tutorial refers to an outdated repository)

Loading a package from a VCS repository not working

I am trying to use a personal repository with modified code of someone elses repository on GitHub.
I did exactly what getcomposer.org said by adding repositories in composer.json.
Whenever I composer update though, I check the code and it's always the original one instead of mine.
This is my composer.json.
{
[...]
"repositories": [
{
"type": "vcs",
"url": "https://github.com/GiampaoloFalqui/php-phantomjs"
},
{
"type": "vcs",
"url": "https://github.com/GiampaoloFalqui/tesseract-ocr-for-php"
}
],
"require": {
"laravel/framework": "4.2.*",
"codesleeve/asset-pipeline": "dev-master",
"jonnyw/php-phantomjs": "3.*",
"thiagoalessio/tesseract_ocr": ">= 0.2.0"
},
[...]
}
Solved by branching the code in a branch that is not master and by adding dev- followed by the branch name in the composer.json (in my case bugfix), like this:
"require": {
"laravel/framework": "4.2.*",
"codesleeve/asset-pipeline": "dev-master",
"jonnyw/php-phantomjs": "dev-bugfix",
"thiagoalessio/tesseract_ocr": "dev-bugfix"
},