work with composer in php - php

hi I have a problem in adding illuminate/html to my laravel project in my composer.json file. I've added this code to composer.json:
"require": {
"illuminate/html": "~5.0"
},
I think after doing this, I should execute:
composer update
in cygwin in the folder of my project. When I do this, I get this error:
Composer could not find the config file: C:\ProgramData\ComposerSetup\bin
please help me thanks.

Related

Use package installed via composer in Laravel

I have installed library called chosen js via composer. Now I have it in my composer.json file
"require": {
"harvesthq/chosen": "^1.8"
},
How can i use it in my project? Where do I need to require it ?
Install any packages in the Laravel
(1)first way: via composer
open project path in terminal and fire this command
composer require harvesthq/chosen
(2)Second way: add package name in composer.json file
"require": {
"harvesthq/chosen": "^1.8"
},
and fire this command
composer update

Laravel 5.2: While moving to production, class "Collective\Html\HtmlServiceProvider" not found in vendor folder

I have been trying to move my laravel app to production. I following below steps
1. git clone
2. composer install
3. set env variables
4. (artisan key:generate)
5. artisan migrate --seed
But when i ran composer install, am getting the following error
Class 'Collective\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
I know this error means, laravelcollective not added in composer.json and need to following steps as mentioned here
But i already have done the same thing in dev mode and now the composer.json has require "laravelcollective" and aliases in config/app.php.
My question is, do i need to the same thing what i have done in dev (resolving laravelcollective issue) for every new production instance that i am gonna set it up ?
if your project working fine locally, then you have to Run composer update commend under your project repo. did you uploaded vender folder?
Also try to upload(only) vender/composer folder into your vender, and then try to runcomposer installorupdate` command
update it in your composer.json file.
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laravelcollective/html": "5.1.*"
},
then in run command 'composer update' after it add dependancy in you app/config/app.php file..
Try:
composer install --no-scripts
this should install all the dependencies without problem

Class 'Pimple\Container' not found

I am trying to install Pimple in my project following https://github.com/silexphp/Pimple readme file.
Error message I receive is:
Fatal error: Class 'Pimple\Container' not found in E:\www\public\index.php on line 9
My composer.json file is:
{
...
"require-dev": {
"phpunit/phpunit": "5.1.*"
},
"require": {
"pimple/pimple": "~3.0"
}
}
When I do:
composer update
or
composer install
the message is: Nothing to install or update
In vendor/bin I can see only phpunit files. I can see however pimple in composer.lock
My PHP index.php file:
<?php
use Pimple\Container;
$co = new Container();
?>
Could you please help me make it work?
vendor/autoload.php was not included and this caused the error.
Try to delete Vendor content, and install dev again througth composer.

Missing 'Illuminate\Routing\ControllerServiceProvider' class on Laravel 5.2

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.

Loading a composer package into Laravel 5

Solved: I've added the php and illuminate/support packages into my package composer.json file and it started working. I've got no idea why though so if someone could explain, I would really appreciate it.
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0"
},
I've created a composer package for Laravel 5 which should generate models based on an existing database schema. However i'm unable to load it in.
I add my Command class into the app/Console/Kernel.php
'Iber\Generator\Commands\MakeModelsCommand'
But then I get the following error:
Class Iber\Generator\Commands\MakeModelsCommand does not exist
I'm really new to Laravel and I'm not sure why this is happening since composer generates the autoloader file just fine. I've created and added (into config/app.php) a Service Provider but that doesn't get resolved either. Not sure what I'm doing wrong.
Here's the package:
https://github.com/ignasbernotas/laravel-model-generator
Apparently adding the required attribute with the following packages solved the issue. I'm still not sure why.
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0"
},

Categories