i have been trying to use this yii2-multiple-input widget but can't seem to be working. I have put the downloaded folder inside the vendor dir.
Error : Class 'unclead\multipleinput\MultipleInput' not found
The preferred way to install this extension is through composer.
Either run
php composer.phar require unclead/yii2-multiple-input "~2.0"
or add
"unclead/yii2-multiple-input": "~2.0"
to the require section of your composer.json file.
Related
I want to use https://github.com/Dewbud/CardConnect this library in my project but don't know how to download by using composer, library developer does not mention in the documentation.
They are listed at Packgist which means you can either add it to your project from the command line using the following command:
composer require dewbud/cardconnect
Or by adding the following to your composer.json file:
"require": {
"dewbud/cardconnect" : "2.*"
}
I want to use a library that's registered with composer in Magento 2 admin.
The library is
https://packagist.org/packages/flagshipcompany/flagship-api-sdk
I have a custom module that adds a button to admin order view and on the click of the button, the controller is called. I need to use this library in that controller.
I'm very new to composer and Magento. I'm not even sure if my composer.json is correct.
I have executed composer install in my module directory and I have the vendor directory.
The directory structure is
Magento2/app/code/MyCompany/MyModule/
Controller/Adminhtml/ControllerName/Index.php
etc/adminhtml/di.xml
etc/adminhtml/routes.xml
etc/module.xml
Plugin/....
composer.json
composer.lock
vendor/[all the composer generated directories]
I need to use require 'vendor/autoload.php' in Controller/Adminhtml/ControllerName/Index.php. But everytime I put this line of code, it crashes.
Also, once I am able to use autoload.php, I need to create an object of class Flagship which is present at vendor/flagshipcompany/flagship-api-sdk/Shipping/Flagship.
TIA
Composer is a php dependency manager and it can be used with Magento as well. Here are the steps to install composer and check composer.json:
First open the composer.json file and add the following code to use the "flagship-api-sdk" package:
"require": {
"php": ">=7.1.0",
"flagshipcompany/flagship-api-sdk": "",
"phpunit/phpunit": "^6.5",
"tightenco/collect": "^5.7"
}
Then go to the folder where you have installed Magento and using terminal/command prompt, run the following commands:
composer install
Make sure you are connected to the internet, this process will take 3-5 minutes.
After this you can check if the dependencies are installed using
composer show
P.s Make sure you have php version 7.1.0 or above and using Magento 2.2
What are all the step by step process to install phrets in ubuntu?
I tried the following, but then unable to run phrets
First I got installed composer.
Then I ran composer require troydavisson/phrets
Now I have two files composer.json and composer.lock, and a folder named "vendor"
Inside vendor folder, I can see autoload.php file and some other folders
Now I tried the sample code from phrets git
But then am getting the following error,
PHP Fatal error: Class 'Monolog\Logger' not found in /var/www/testing/newphrets.php on line 7
Please advice what am missing here. Am planning to switch my project from old version to phrets 2.0.
Thanks
According to Troy's PHRETS 2.0 Logging video on YouTube and looking at PHRETS' composer.json, you can see that you need to do one of two things. Either,
(a) Add monolog to your project's composer.json,
{
"require": {
"troydavisson/phrets": "2.*",
"monolog/monolog": ">=1.10"
}
}
and run composer update in your project's root directory.
or,
(b) Since monolog is in PHRETS' composer.json file but in the require-dev section, run composer install --dev or composer update --dev to indicate you're currently in development and would like to use the development libraries.
I want to use Slim for PHP in my project for the first time.
The manual says:
Install composer in your project:
curl -s https://getcomposer.org/installer | php
Create a composer.json file in your project root:
{
"require": {
"slim/slim": "2.*"
}
}
Install via composer:
php composer.phar install
Add this line to your application’s index.php file:
<?php
require 'vendor/autoload.php';
I'm afraid, I don't get it. Where should the commands "curl" and "php" be used? I only access my webspace through Filezilla. How can I then apply such a command?
What do those steps do anyway? Sadly, the manual is not helpful at all.
See http://www.slimframework.com/install:
MANUAL INSTALL
Download and extract the Slim Framwork into your project directory and require it in your application’s index.php file. You’ll also need to register Slim’s autoloader.
<?php
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
And there are links to zip-files.
If you're getting started on slim i'd definitely suggest that you get a good IDE that will guide you through the whole process. When I started the slim framework, I came across an IDE by jetbrains called PHPStorm. It makes everything so easy by doing most of the stuff you listed for you...
download and install PHPStorm https://www.jetbrains.com/phpstorm/download/
download and install Composer https://getcomposer.org/download/ so PHPStorm can use it.
get to the part where you start PHPStorm.
go to File > new Project > Composer Project and follow the motions.
It'll create all the files you listed. Then all you have to do is look and learn what it all means.
Composer is basically a package manager, you basically open a cmd and navigate to the place you want to create you PHP Slim application and type some composer commands to install package files in that folder. Composer then gets the packages and puts them in a directory called 'vendor' in that project folder of yours.
{
"require": {
"slim/slim": "2.*"
}
}
that's basically a config file that either you or composer will create in the same file also.
I have downloaded the latest version of Doctrine ORM and on their site it says:
"See the configuration section on how to configure and bootstrap a downloaded version of Doctrine."
Then i go there ( http://docs.doctrine-project.org/en/latest/reference/configuration.html ) and i find at "class loading" section, that i have to add the following line to my project:
require_once "vendor/autoload.php";
Where's that autoload.php file? Where's the vendor folder? I don't get it...
Thanks.
When you downloaded the 'latest version' it included that autoload file. Locate it in the download and change the file path in the require_once function the the path of the file:
require_once "/location/of/files/you/downloaded/vendor/autoload.php";
As you can see about 400px down on the page here, you need to use to PEAR to install the files first:
http://www.doctrine-project.org/projects/orm.html
You can do it by installing composer first. Follow the guide in this page http://getcomposer.org/doc/00-intro.md. There's a description for Windows and Unix users, this will install composer, then create a json file that looks like this:
{
"require": {
"doctrine/orm": "2.*",
"symfony/yaml": "2.*"
},
"autoload": {
"psr-0": {"": "src/"}
}
}
Then from the cmd/terminal, run this command: composer install
You will find that the vendor folder is created automatically.