Installing multiple packages with composer? - zend-framework

I am trying to install the latest version of Zend Framework 2 with composer and also install at least one other package at the same time. The other package is another Zend Framework package. The two packages are:
zendframework/zendframework
zendframework/zendservice-twitter
I added zendframework/zendservice-twitter to the require section of that file. It doesn't look like there is any other section to use to install multiple packages in the same directory tree. But when I try to add zendframework/zendservice-twitter to the require section of the composer.json file, it tells me that zendframework/zend-uri is required. But zendframework/zend-uri is installed by the zendframework/zendframework package. It is listed in the replace section of that composer.json file. So apparently the replace section is not the place to add other packages that need to be installed. But you can't have multiple composer.json files in the same directory either, so is it even possible to install Zend Framework 2 and ZendServiceTwitter in the same installation with composer?
When I download a package as a zip file from https://packages.zendframework.com/#composer, I get a composer.json file in the zip file, but it does not have the same repository setting that it says to use at https://packages.zendframework.com. So I am not sure if that composer.json file is intended to be edited in order to upgrade or reinstall.
Isn't there some way to tell composer that this is a circular dependency?

I don't see the circular dependency. The twitter package requires zend-uri, and zend-uri is provided by the main Zend Framework package that you've already installed.
I just tried this out on a fresh checkout of the skeleton app and it worked fine. All I did was add the twitter package to the require section of my composer.json:
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.3.*",
"zendframework/zendservice-twitter": "~2.1.0"
}
(2.1.0 is the latest version of it at the moment.) You don't need to touch the replace section.

Related

Install Third party library in Prestashop

I am trying to install a JWT Library (i.e https://github.com/web-token/jwt-framework) in Prestashop,
I am not sure how to install & use it.
Do i need to run composer require web-token/jwt-framework in PS root to install it?
Composer is installed by default in prestashop versions 1.7+.
If you are starting a new project you can init your composer project along with the dependency:
composer init --require="web-token/jwt-framework" -n
composer install
Or if you already have an existing project simply add the dependency:
composer require web-token/jwt-framework
Then update your composer.json file to include the class in your autoload nad regenerate it:
composer dump-autoload
(Installing webservice library if u want to see documentation example: LINK)
If u want to use library in your module here is the link to documentation on how to do it: LINK
Although you can go to github repo of this library and download it manually.

composer.json file configuraton to install Shopware 6 plugins in custom/plugins directory

Require shopware 6 plugin via composer
Following up on this question and answer. I wondered what else anyone has added to install a plugin into custom/plugin for Shopware 6? I removed my composer.lock and the vendor and var/cache directories. I and trying to do the same thing, and I have required composer/installers to my plugin composer.json file and added:
"extra": {
"installer-paths": {
"custom/plugins": ["type:shopware-platform-plugin"]
}
}
to the root composer.json but it is still putting my plugin into the vendor directory. Any suggestions would be truly appreciated.
You don't need any installers or other tools for installing plugins via composer.
If you have placed your plugin in custom/plugins (in case you are using the development template) or in custom/static-plugins (in case you are using the production template/zip installation) your plugin will be symlinked to your root vendor directory, if you composer require your plugin.
For Shopware 6 it doesn't matter where your plugin is located.
If you don't like the behaviour, that your plugins are symlinked, you can simply remove the repository configuration from the root composer.json. Above I have linked the positions you need to change.

Can I include files in a NuGet package, but only when package is installed directly (not as a dependency)?

I want to create a NuGet package that contains files that are added to the project the package is installed to. So far, everything is straightforward.
But then, I want to create a NuGet package from that project as well. And install it to a third project. Is there any way to avoid that the files from the first project are added to that third project?
This is the setup:
Acme.Doxygen - "First package" - sets up the target project for doxygen generation
Acme.MyToolLibrary - "Second package" - I want to import Acme.Doxygen here, so that this project is documented using Doxygen. Acme.Doxygen adds a file "Doxyfile" to the root of this project.
Acme.MyWebSite - "Third package" - I want to install MyToolLibrary in this project, but this project is not interested in Doxygen.
The problem: When I install Acme.MyToolLibrary in Acme.MyWebSite, Doxyfile is added to the root of Acme.MyWebSite. My website is not interested in Doxygen, and I don't want this to happen.
To avoid that Acme.MyWebSite has a dependency on Acme.Doxygen, I have set 'developmentDependency="true"' on the reference to Acme.Doxygen in the packages.config file in Acme.MyToolLibrary. This works fine - Acme.MyWebSite does not depend on Acme.Doxygen. But - how can I configure my NuGet package so that the same logic applies to the Doxyfile included in my NuGet package?

How to put Nuget libraries on a folder

i generally add any library from Nuget to my project like issuing this command
Install-Package Mvc3Futures
then i have seen everything related to that library just added in my project. some one told me that library can be added to folder and later we can add that folder to my project like this way tools > options > package manager - add your folder .
really i have no idea how we can add library to any folder from Nuget. if it is possible then please show me the way in step-by-steps. thanks
I cannot give you a step-by-step, but you can relocate/specify the place of the packages folder: Is it possible to change the location of packages for NuGet?. But this way all of your packages location will change, I don't think you can do that per package. During installation you can specify where you install the package from (but not to): http://docs.nuget.org/docs/reference/command-line-reference, see Install Command.

NuGet and Portable Class Libraries - Package doesn't target any framework

I have been using NuGet to manage my internally created assemblies for a few months, and it's working very well. I recently 'discovered' portable class libraries, which has also been great - until it's time to install the packages.
Say I have a PCL that targets .NET 4.5, SL5 and .NET for Windows Store Apps. I run nuget spec to create the .nuspec file, edit the values, package it up, and add the .nupkg to our internal feed. If I open the .nupkg file in the Package Explorer, I see one content folder under lib called portable-win+net45+sl50.
When I try to install the package from any compatible project in another solution, I get the following message:
"'Project.PCL' could not be installed because it is not compatible with any project in the solution. The package doesn't target any framework."
If I manually create the .nupkg in the Package Explorer, updating the version number, adding a lib folder for each targeted framework (not a portable folder) and added the Project.PCL.dll to each folder, I can add the package to the compatible projects in the solution. But to do this process every time I want to update a PCl is somewhat tedious (I had been creating a little .cmd file in the project root folder to quickly package and deploy).
Do other people have this problem? How can I package PCL's in the same way as other types of projects?
Note - I'm using VS 2012 Ultimate and NuGet 2.2
It sounds like maybe nuget spec doesn't work for Portable Class Libraries - that's worth starting a thread or filing an issue on the NuGet site.
However, you can also create a .nuspec file from NuGet Package Explorer. Just create the package as you already did, but then choose "Save Metadata As..." to save it as a .nuspec. Afterwards you may need to edit the source paths in the nuspec file manually, but you should be able to automate the creation of the package.
For me nuget spec and nuget pack worked fine with a portable project while creating the package and installing it on a compatible project.
Do you want to check if you have the latest nuget.exe (2.2), it can be downloaded from http://nuget.org/nuget.exe or can be updated by running nuget update -self