I have forked the package laravel-forum by riari and edited the branch 5.0 (that is not the main branch).
Now I want to use my fork within my composer.json file. Usually, when the forked branch is called master, I am using dev-master instead of master for my forked repositories (e.g. the42coders/eu-cookie-consent or highsolutions/laravel-translation-manager.
When I am using the main version by
"riari/laravel-forum": "~5.0"
everything is working fine, but now I didn't find a way to use my dev version:
Neither of them are working:
"riari/laravel-forum": "dev-master"
"riari/laravel-forum": "dev-5.0"
"riari/laravel-forum": "dev-~5.0"
The error message is saying:
Problem 1
- Root composer.json requires riari/laravel-forum dev-master, found riari/laravel-forum[dev-laravel-4, dev-laravel-5, dev-5.0-feature-test-threads, dev-plural, 1.0.0, ..., 1.2.3, 2.0.0, ..., 2.5.0, 3.0.0-RC1, ..., 3.1.9, 4.0.0, ..., 4.1.5, 5.0.x-dev] but it does not match the constraint.
What can I do to get it working?
"repositories": [
{
"type": "vcs",
"url": "https://github.com/tms1987/laravel-translation-manager"
},
{
"type": "vcs",
"url": "https://github.com/tms1987/eu-cookie-consent"
},
{
"type": "vcs",
"url": "https://github.com/tms1987/laravel-forum"
}
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"highsolutions/laravel-translation-manager": "dev-master",
"laravel-lang/lang": "~8.0",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.2",
"riari/laravel-forum": "dev-5.0",
"the42coders/eu-cookie-consent": "dev-master"
Related
As the Laravel 8 is not supported on PHP 7.0, I decided to go with lower version of Laravel. Because, we are not in the position of upgrading the server php version.
After reading the requirements here we found the latest Laravel version that is supported in PHP7.0 will be Laravel5.5.
we installed the version using composer. Below is the Laravel version in the server.
However, still the error shows in the nginx server as below
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5".
The composer.json in the laravel root directory as below
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
}
Any workaround to bring the application live?
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
"platform" : {"php": "7.0.3"},
}
This fakes an environment. Maybe this helps.
I recently discovered a vulnerability in a package that I like to use in my Laravel projects. The package is a log viewer for Laravel: https://github.com/ARCANEDEV/LogViewer.
I put in an issue about the vulnerability and the owner said I can put in a Pull Request to try and rectify the issue, and I feel I could at least try.
My question is: is there a way to use the version of the package with my Pull Request in a testing environment, as if I were installing it via Composer?
Essentially, away from actual unit tests, is there a way to test run a package in a project?
Updates given research and available answers
After much Googling and reading of answers I tried the following:
Fork the repo I'm looking to make a pull request for. The fork is here: https://github.com/blorange2/LogViewer
Clone this forked repo onto my local machine and switch to the branch that's compatible with my current version of Laravel (which is v4.5 for Laravel 5.6)
Update the composer.json in my local project to have a repositories array
"repositories": [
{
"type": "path",
"url": "../forks/LogViewer"
}
],
With the whole thing looking like this:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "path",
"url": "../forks/LogViewer"
}
],
"require": {
"php": "^7.1.3",
"alexusmai/laravel-purifier": "^0.5.0",
"arcanedev/log-viewer": "^4.5",
"artesaos/laravel-linkedin": "^1.3",
"barryvdh/laravel-dompdf": "^0.8.4",
"cartalyst/tags": "6.0.*",
"cornford/googlmapper": "^2.33",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"guzzlehttp/psr7": "^1.4",
"happyr/linkedin-api-client": "^1.0",
"intervention/image": "^2.5",
"ixudra/curl": "^6.16",
"jdavidbakr/mail-tracker": "~2.1",
"laravel/framework": "5.6.*",
"laravel/scout": "^5.0",
"laravel/socialite": "^3.0",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.6",
"laravolt/avatar": "^3.0",
"league/flysystem-sftp": "~1.0",
"maatwebsite/excel": "^3.1",
"maddhatter/laravel-fullcalendar": "^1.3",
"mews/purifier": "^2.1",
"php-http/curl-client": "^1.7",
"php-http/message": "^1.6",
"pusher/pusher-http-laravel": "^4.2",
"socialiteproviders/microsoft-graph": "^2.0",
"spatie/calendar-links": "^1.0",
"spatie/flysystem-dropbox": "^1.2",
"spatie/laravel-analytics": "^3.6",
"spatie/laravel-backup": "^5.9",
"spatie/laravel-medialibrary": "7.6.3",
"spatie/laravel-permission": "^2.12",
"teamtnt/laravel-scout-tntsearch-driver": "^3.0",
"thujohn/twitter": "^2.2",
"unisharp/laravel-filemanager": "~1.8",
"vimeo/laravel": "^5.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
"autoload": {
"files": [
"app/Helpers/Helper.php"
],
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
My main project is located at the following path (from running pwd on Windows) C:\xampp\htdocs\projects\newable\newable-intranet
The cloned, forked project is located here: C:\xampp\htdocs\projects\forks\LogViewer.
However, running composer update does not use the local version, it just uses: "arcanedev/log-viewer": "^4.5",
When you want to use a custom version of a library in your project like with the original package, you can modify the composer.json.
You can add custom package sources (aka repositories) to your composer.json for local development I prefer the path-repository:
{
"repositories": [
{
"type": "path",
"url": "../LogViewer"
}
],
"require": {
"arcanedev/log-viewer": "*",
...
},
...
}
So if your project and LogView-library are in the same workspace directory, side by side, this will jump up to that workspace-directory and go into the library folder. In there it will look for a composer.json. You should then be able to update to your custom library, e.g. using composer require arcanedev/log-viewer:"*" or by manually changing the entry as shown above and then runcomposer install`.
Making composer download the custom version can be a bit tricky from time to time, but in general this should work. If it won't "download" your version, i.e. symlink the local folder, try removing the existing vendor folder and running composer install again. You can also add debug output to composer install -vvv to see if the repository is found and used.
The less elaborate approach would be to remove the original library folder inside your project's vendor/ folder and instead place a symlink to your custom library manually. This is usually enough when all you do is a small bugfix inside the library's code, but when you change dependencies and version requirements I prefer the first approach as it basically simulates downloading the package through composer making sure it is properly usable in client projects.
I'm trying to get Composer to install the 3.0.0 branch of a GitHub project (onelogin/php-saml). However, no matter what I try, it keeps trying to install the master branch version (2.12). Am I missing something? Below is my composer.json
{
"name": "munkireport/munkireport-php",
"description": "Reporting tool for munki",
"type": "project",
"license": "MIT",
"require-dev": {
"squizlabs/php_codesniffer": "^2.5"
},
"require": {
"php": ">=7.0.27",
"ext-dom": "*",
"guzzlehttp/guzzle": "~6.0",
"hautelook/phpass": "^1.1",
"illuminate/console": "~5.4",
"illuminate/database": "5.4.36",
"illuminate/filesystem": "~5.4",
"league/flysystem": "~1.0",
"rodneyrehm/plist": "^2.0",
"doctrine/dbal": "~2.5",
"defuse/php-encryption": "^2.1",
"onelogin/php-saml": "3.0.0-dev"
},
"suggest": {
"adldap2/adldap2": "^8.0 Required for AD authentication"
},
"autoload": {
"psr-4": {
"munkireport\\models\\": "app/models/",
"munkireport\\controller\\": "app/controllers",
"munkireport\\lib\\": "app/lib/munkireport"
}
},
"repositories": [
{
"type": "git",
"url": "https://github.com/onelogin/php-saml"
}
]
}
Output:
Using version ^2.12 for onelogin/php-saml
I was able to bypass this with the following command:
./composer require onelogin/php-saml:3.0.0.x-dev
I have created composer package, which composer.json is
{
"name": "xxxx/yyyyy",
"description": "xyz",
"license": "MIT",
"authors": [
{
"name": "xxx",
"email": "xx#ttt.com"
}
],
"version": "1.0.0",
"type": "package",
"minimum-stability": "dev",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"tymon/jwt-auth": "0.5.*",
"dimsav/laravel-translatable": "^6.0",
"doctrine/dbal": "^2.5",
"felixkiss/uniquewith-validator": "2.*",
"owen-it/laravel-auditing": "^3.1",
"venturecraft/revisionable": "1.*",
"yadakhov/insert-on-duplicate-key": "^1.1"
},
"autoload": {
"psr-4": {
"XXX\\YYY\\" : "/src"
}
}
}
Now, when i install my
xxxx/yyyy
package, I need that composer install all required packages:
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"tymon/jwt-auth": "0.5.*",
"dimsav/laravel-translatable": "^6.0",
"doctrine/dbal": "^2.5",
"felixkiss/uniquewith-validator": "2.*",
"owen-it/laravel-auditing": "^3.1",
"venturecraft/revisionable": "1.*",
"yadakhov/insert-on-duplicate-key": "^1.1"
},
but it dont install it.
I try composer update, composer install. Can someone help?
Project Composer.json looks like
{
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"xxxx/yyyy" : "1.0.0"
},
"repositories": [
{
"type": "package",
"package": {
"name": "xxxx/yyyy",
"version": "1.0.0",
"source": {
"url": "example.com",
"type": "git",
"reference": "master"
},
"autoload": {
"psr-4" : {
"XXX\\YYY\\" : "/src"
}
}
}
}
]
}
What I can do, that Composer automatically install all package required dependencies???? Thanks for advice.
Don't use the package repository type. When you use this, you have to copy all information that usually resides inside the composer.json file of the software you are referencing.
package repositories are for scenarios where you are unable to add a composer.json file to the origin of the software. You have full control over your package, so this does not apply.
Just add a repository link of type vcs with the URL to the repository, and Composer will figure out the rest by looking at the composer.json file inside the repository. It will detect the dependencies and install them.
So, Laravel spark isn't letting me connect to the github any more and it's causing me to be unable to push to heroku and completely halting my work. I tried placing the spark code in a folder and then making the code path repository. However, when I run composer update it still tries to fetch the code from the same github location. Seems like it isn't finding the repo.
I have tried tons of path variations and placing the code in various locations. Here is the section from the composer:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"laravel/spark":"*",
....
"repositories": [
{
"type": "path",
"url": "vendor/laravel/spark"
},
{
"type": "composer",
"url": "https://spark-satis.laravel.com"
}
],
And, in the package composer ...
"name": "laravel/spark",
"description": "Laravel Spark provides scaffolding for Laravel SaaS applications.",
"keywords": ["laravel", "stripe", "billing", "scaffolding", "saas"],
"license": "MIT",
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell#gmail.com"
}
],
"require": {
"php": ">=5.5.9",
"erusev/parsedown": "~1.0",
"firebase/php-jwt": "~3.0",
"guzzlehttp/guzzle": "~6.0",
"ramsey/uuid": "^3.1",
"intervention/image": "^2.3"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"mpociot/vat-calculator": "^1.6"
},
"autoload": {
"psr-4": {
"Laravel\\Spark\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"minimum-stability": "dev"
Is there something that I am missing to ensure that composer uses the path repo instead of looking at github?
Push laravel/spark code to your own git repo, than inside composer.json use
"repositories": [
{
"type": "vcs",
"url": "https://path to your repo"
}
],
and run composer require laravel/spark, It should take the code from your repo
Since laravel/spark is not free anymore and cannot be installed or updated with composer
You have to purchase license version to use it.
https://spark.laravel.com/licenses