After installing Composer, I then went to c:\xampp\htdocs and executed the following command:
composer create-project laravel/laravel khandakhulu --prefer-dist
I then get the following error:
[Composer\Repository\RepositorySecurityException] The contents of http://packagist.org/p/laravel/laravel$a996426ffd2d6fcd0d9a 2dfdd97171b28b3d196d34061f15d79ce67004b9c19d.json do not match its signatur e. This should indicate a man-in-the-middle attack. Try running composer ag ain and report this if you think it is a mistake.
Basically we need to force the composer use https repository at composer.json as we know from Laravel.io Forum
But we don't have any skeleton of laravel project. So, use Laravel Installer instead. This global installation generate composer.json at ~/.composer/composer.json and modify to this
{
"require": {
"laravel/installer": "~1.1"
},
"repositories": {
"packagist": { "url": "https://packagist.org", "type": "composer" }
}
}
First time installation of Laravel Installer maybe will get same error, after you force the respository URL. Finally, create your new Laravel application.
~/.composer/vendor/bin/laravel -v new justapp
Related
I have updated the composer.json file as instructed on the upgrade guide on Laravel 5.2 Documentation and run composer update.
Everything was updated correctly, but composer dumped the error below while generating autoload files.
Class 'Illuminate\Routing\ControllerService Provider' not found in /home/vagrant/Code/homework/vendor/laravel/framework /src/Illuminate/Foundation/ProviderRepository.php on line 146
Make sure you remove Illuminate\Routing\ControllerServiceProvider from your /config/app.php.
https://www.laravel.com/docs/5.2/upgrade (see the "Service Providers" section)
Problem is with your composer.json.It may got corrupted. Make sure
"require": {
"laravel/framework": "5.2.*"
},
exists.Then run composer update.
I got this requirement in my composer.json:
"php": ">= 5.6",
"symfony/http-foundation": "^3.0"
The problem with that configuration is that it will install paragonie/random_compat v9.99.99 which is only compatible with PHP 7 and more. But the thing is that I don't want my composer.lock file to require PHP 7, I want it to still be compatible with PHP 5.6.
The solution I found is to track down which package was pulling this dependency and, once I found it, I added this to my requirements:
"paragonie/random_compat": "~2.0"
But I wonder if there is not a better way of doing that: somehow telling that I accept all the versions above PHP 5.6, but I don't accept packages that would force to have PHP 7?
If you want to make composer.lock compatible with PHP 5.6, you have at least two options to achieve that:
Use PHP 5.6 for composer update - you should be able to install multiple versions of PHP on your OS and run Composer like this:
/path/to/php6.5 /path/to/composer update
Use platform settings in composer.json to force installation for specific version regardless PHP version used to run Composer commands:
"config": {
"platform": {
"php": "5.6.38"
}
},
The constraint that I am interested in is
"require":{ "php": "..."
Is there a way to target php 7.1 for the project packages in composer.json even though I'm running 7.2 when I call composer update/install on the command line?
You can use platform configuration from Composer: https://getcomposer.org/doc/06-config.md#platform
Basically, your composer.json would look like this:
{
"require": {
...
},
"config": {
"platform": {
"php": "7.1"
}
}
}
This will make sure that you install only packages compatible with PHP 7.1, no matter which PHP version you use to actually install the packages.
I have developed my project laravel 5.0 but, I want to install the package for Data-tables. I have tried this package with below-mentioned versions.
composer require yajra/laravel-datatables-oracle:^6.0
composer require yajra/laravel-datatables-oracle:~5.0
"yajra/laravel-datatables-oracle": "^6.6.0",
composer require yajra/laravel-datatables-oracle:~6.0
This package is not installing in my project. Please suggest me any other package for Datatables Laravel 5.
I think you need to do is to add the following in your composer.json file:
"require": {
"yajra/laravel-datatables-oracle": "~6.0"
}
after run composer update command in cmd
Hope this work for you!
I am using composer for the first time so if I shouldn't be posting here I am very sorry.
I am following a youtube tutorial on the paypal api I have installed composer and created the json file the same as the example. composer.json is saved in the root folder for the website. the structure is below. composer diagnose composer.json: fail and property name is required.
{
"require": {
"paypal/rest-api-php": "1.5.1"
}
}
looks like your composer had much fresher version, check composer --version !
need to update composer.json with:
{
"name": "some/name",
"description": "Some description will be useful too!",
"require": {
"paypal/rest-api-php": "1.5.1"
}
}
or install some old version, by exec 3lines
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.0.1
php -r "unlink('composer-setup.php');"
The best way to start a project using Composer:
composer init
This will ask you some questions, some of them with sensible defaults that you can simply accept - others (like the name of your project) cannot be guessed.
The best way to install a package after that
composer require package/name
Optionally for development packages:
composer require --dev package/name
The composer command used here assumes you have downloaded "composer.phar" and renamed or symlinked it in a way that it can be called just by typing composer. Otherwise, replace that command with the one that works for you, like php composer.phar or composer.phar.