Laravel 4 Package installation using composer - php

I need to know how to install packages in laravel 4.
I have downloaded a bundle from github, but executing the bundle, I see it is deprecated in Laravel 4. Can anyone please help me.

Just using packagist, you can go to packagist.org , after that just put the package name at require key in your composer.json on your laravel project, and that run this command , composer update or compose install
in example :
// composer.json
"require": {
// default value..
"intervention/image": "dev-master",
}
i hope this help

Laravel 4 now uses composer to install packages.
You can add new packages to laravel via a few options on composer. One is on the command line.
> composer require author/package
> dev-master
After issuing the require command it will ask you what version to use. then run composer update, add the PackageServiceProvider to your app/config/app.php

First and always if you plan to use composer in your work, learn the basics of it (what is composer.json,composer.lock...)
There is excellent video on Laracasts https://laracasts.com/lessons/you-must-use-composer
That way you can avoid problems and enjoy using this great package manager.
Next use composer dump(-autoload) command frequently and composer self-update.
If that bundle is deprecated in Laravel4 than it is deprecated and you can't use it ( unless author made some changes and adopt it for l4 )
Also bundle is a l3 specific type and in l4 we have packages.

Ok, you can't execute composer commands on windows command prompt. mac/linux terminal would do but if you insist on using windows then install this [https://www.cygwin.com/] so you could issue unix commands

Related

Laravel PackageManifest.php: Undefined index: name

I'm just trying to deploy my application and I just ran composer update on my server and I got the following error:
In PackageManifest.php line 122:
Undefined index: name
How can I fix this issue?
As a temporary fix, try this, it worked for me, in the following file:
vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php
Find line 116 and comment it:
$packages = json_decode($this->files->get($path), true);
Add two new lines after the above commented line:
$installed = json_decode($this->files->get($path), true);
$packages = $installed['packages'] ?? $installed;
I had the same problem, I just execute the command:
composer update
this will updated the composer.lock file.
After that worked like a charm.
I found this issue on the composer GitHub repo that helped a lot
I updated my Laravel framework from 5.8 to 5.8.38, following the table displayed in that issue and the error disappeared.
This Laravel blog post also helps
If you can't upgrade Laravel, you can just stay with Composer 1 by running
composer self-update --1
I recently switched composer 2.0.8 and my Laravel version is 6.20.27
To solve this issue:
Step 1:
Delete compose.lock File
Step 2:
Install dependencies.
composer install
I had the same problem.
In my case downgrading the composer version fixed the problem.
They updated Composer 4 times within 2 days - I think they had a problem with their newest updates.
In my case version 1.10.1 was the version to go with.
sudo composer self-update --1
I hope it'll work.
I had a problem like this, and also tried composer self-update --stable, but there was no result. So, I found that this file belongs to the Laravel framework. So the following command resolved this issue:
$ composer update laravel/framework
In my case downgrading the composer version fixed the problem.
sudo composer self-update --1
https://github.com/composer/composer/issues/9340#issuecomment-716210369
As stated in here, your laravel version may conflict with composer 2
composer update laravel/framework
should fix your problem :D
The easiest way to solve this issue is
delete composer.lock file from your project.
Run composer install
I was facing the same issue. I Saw my Laravel framework version is "laravel/framework": "6.0"
So just put the cap before the version and it starts working fine.
"laravel/framework": "^6.0"
Running the following command worked for me. Maybe this will help someone needy.
composer update
I removed my vendor folder and composer.lock and ran composer install again. This solved it for me.
Running composer update worked for my project with Laravel 5.7
Some versions of composer give this error, the version 1.10.20 doesn't throw this error
composer self-update 1.10.20
composer install
For my Laravel 5.7 project deleting vendor folder and composer.lock file fixed the issue.
I have a solution:
Delete the vendor folder.
run composer install
Don't use --no-scripts. This will cause a problem, and will not create the appropiate folders which the file PackageManifest.php and others need.
run composer update
This is so you don't have problems with bugs in the file.
Try this, it is worked for me, in the following file:
vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php
Find this line and comment on it
$packages = json_decode($this->files->get($path), true);
Add two new lines after the above-commented line
$installed = json_decode($this->files->get($path), true);
$packages = $installed['packages'] ?? $installed;
If you want to fix without making updates and composer updates
just go to vendor/composer and remove installed.json
Running the following command fixed it for us
composer self-update --stable
No need to force an upgrade on your packages (running composer update on production is not recommended anyway) or downgrade your Composer if it's on version 2.
If you have a website that requires Composer v1 for updates (because, for example, v2 causes errors) and you have version v2 installed globally, the quickest solution is:
Step 1
Download the latest stable 1.x composer.phar from https://getcomposer.org/download/ (under Manual Download).
Step 2
Place the downloaded composer.phar file in the root of your project (where the composer.json file resides).
Step 3
Run your command using the composer.phar file. Example:
php composer.phar install
To downgrade composer to an old version:
composer self-update <version>
Example:
composer self-update 1.10.1
here's a solution that worked for me. https://github.com/composer/composer/issues/9340#issuecomment-716210369
change your laravel framework to 6.18.7 so that its compatible with composer 2
If you have composer version 2 upgrade your laravel to 6.2.
https://github.com/composer/composer/issues/9340#issuecomment-716210369
I had the same problem after i clone an laravel project and start composer install. Then I read through some solutions here. In my opinion, it is not a good idea to edit the laravel core. But if it's just for testing, why not.
My solution in my case was composer update instead composer install. In the case of composer update, it does not use the composer.lock file and updates the packages from composer.json. For me and in my special case works.
On my computer composer version 2.0.9 was installed, I had the same problem when upgrade laravel project.
the solution is :
Delete Vendor folder inside your project if exist.
inside composer.json for laravel version write this "laravel/framework": "^6.0" don't forget ^ in front of 6.0 it needs to install latest version of laravel 6
then composer update
finally, it works perfectly.
I updated to Composer 2.0.11 and I had the error. Downgraded to Composer 1.10.20, it worked great, BUT IT'S VERY VERY SLOW.
So for those like me who don't want to change the vendor code, and still want Composer 2.0.x know that it was a kind of bug in Laravel, and Laravel has fixed it in minor versions (or hotfixes). I was using Laravel 5.7.9 and my vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php ->build() was like:
if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) {
$packages = json_decode($this->files->get($path), true);
}
But in Laravel 5.7.29 PackageManifest.php , the same file is fixed:
if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) {
$installed = json_decode($this->files->get($path), true);
$packages = $installed['packages'] ?? $installed;
}
Same goes for Laravel 5.6.0 that had the bug, and is fixed in 5.6.40 Laravel 5.6.40 PackageManifest.php. I don't know from which minor version it has been fixed at each level, but I suggest to go for the last, like 5.7.29, 5.6.40 etc. Or you can go look the versions to see if it has been fixed.
NOW COMPOSER 2.0 IS VERY VERY FAST.
If the error is after self updating the composer, just replace composer with composer1.Just change:
composer install ...
into:
composer1 install ...
Just this!
I got this issue because of a Laravel and composer version are not compatible.
Following are the steps I follow to solve this issue:
I update Laravel version from 6.1 to 6.20 in composer.json file Eg: "laravel/framework": "6.20.*"
then delete composer.lock file.
And run composer install command
Now Problem is fixed. :)
run a composer upgrade.
This work for me on laravel 7

Symfony 2.8 TinyMCE install bundle error

i am on symfony 2.8, and my php version is 5.5.9.
i'm trying to install TINYMCE bundle from composer. I used this command line:
php composer.phar require stfalcon/tinymce-bundle='1.0'
i had this message error:
i tried with v2.0 but same problem.
Have you an idea ?
Thank's a lot for your help.
It would seem that in your composer.json's config section you have platform requirements that conflict with the bundle.
https://getcomposer.org/doc/06-config.md#platform
You could try installing the requirements using the option --ignore-platform-reqs:
composer require stfalcon/tinymce-bundle --ignore-platform-reqs
composer install --ignore-platform-reqs
This will momentarily lift the specified platform requirements. Obviously if they are in place, because they are actually needed - and since they were put there deliberately, at least at some point they were - this might break things on production. So be careful and look at the above option first (updating or removing the platform requirements).
Have you tried either of these two commands:
composer.phar require stfalcon/tinymce-bundle='1.0'
composer require stfalcon/tinymce-bundle='1.0'
I'm not sure if it will make a difference, but it might.

Composer installation order

Is it possible to set the installation order?
Currently I'm using Doctrine module that requires ext-mongo to be installed, but as I'm using the newer php version (7.0) I have mongodb installed instead. There's a alcaeus/mongo-php-adapter package that resolves installation problems. But there's one problem - Composer is trying to install Doctrine modules first, so that installation fails.
Currently I have to resolve this problem manually, but I can't do it any more as I'm going to pack my environment to a Docker image to let it be automatically deployed later.
From the docs of alcaeus/mongo-php-adapter
"
$ composer require alcaeus/mongo-php-adapter
If your project already has a dependency on ext-mongo, the command above may not work. This is due to a bug in composer, see https://github.com/composer/composer/issues/5030
To fix this, you can use the --ignore-platform-reqs switch when running the above command, or when running composer update with no composer.lock file present."

Composer BowerPHP Error

I am trying to install BowerPHP in my Laravel framework project on my computer using Composer. I have used the composer require "beelab/bowerphp 0.3.*#beta" command in the command prompt but I'm receiving errors:
Can only install one of : symfony/process[v2.7.9,v3.0.2]
Can only install one of : symfony/process[v2.7.8,v3.0.2]
Can only install one of : symfony/process[v2.7.7,v3.0.2]
etc.
From what I understand my framework already has a version of Symfony and I cannot download another package. In addition, the package that I have is not compatible with BowerPHP. What do I do? And am I correct?
So I found the answer. The beelab team did not update their own website but did update their github page. running the composer require beelab/bowerphp:1.0.*#dev would work but running the on on their website would not.

Laravel: How to modularize? [duplicate]

php artisan workbench vendor/package --resources
command is not available in laravel 5, but how now create package in laravel 5 ?
Shameless self-promotion, but I've written a post about this called "Creating Laravel 5 packages for dummies" that explains how to create the package, how to put it on GitHub & Packagist and how to push changes/new versions afterwards.
If you're already familiar with creating packages in Laravel 4, the fastest solution I've found was to use this CLI tool.
The laravel workbench has been renamed in laravel 5 to "Package Development" in the documentation
http://laravel.com/docs/master/packages
Notice that there is no longer a workbench command and you need to create your own package structure, as the Laravel creator want to limit the dependency between created packages and the Laravel framework (#ref)
UPDATE: Laravel 5 is now stable and the illuminate/workbench package can be used in a laravel 5 application as I suggested in this post
In Laravel, these are some handy tricks I follow each time I need to create a Laravel package
Solution 1: Get a boilerplate template from https://github.com/cviebrock/laravel5-package-template, and put it under packages/ (follow the instruction in the repo)
Solution 2: Use a packager (with Laravel >= 5.5)
Install packager it as dev dependency > composer require jeroen-g/laravel-packager --dev (check instruction in the repo here)
create the package > composer require jeroen-g/laravel-packager --dev etc, see full tuto
then, we have a choice to keep the package in our project, or just remove it by rollingback composer.json
Hope this is a good update for Laravel lovers ;)

Categories