0

I have to include this extension borales/yii2-phone-input to my projects.

From the installation documentation, there are two ways to install

  1. run composer require
  2. add "borales/yii2-phone-input": "*" to composer.json

If using the command line everything works well, but due to some limitations I have to install the extension using the second method. But it prompts this error. Class 'borales\extensions\phoneInput\PhoneInputValidator' not found

My composer.json

"require" : {
    "borales/yii2-phone-input": "*",
    "giggsey/locale": "^1.7",
    "symfony/polyfill-mbstring": "^1.17",
    "bower-asset/intl-tel-input": "^16",
    "giggsey/libphonenumber-for-php": "^8"
}

I have searched for few solutions, but unfortunately no luck to solve my problem.

  1. How do I install Composer PHP packages without Composer?
  2. Check all related dependencies on https://packagist.org/packages/borales/yii2-phone-input

My question is how to install the extension without this command

$ php composer.phar require "borales/yii2-phone-input" "*"

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Beginner
  • 45
  • 1
  • 7
  • First, add in composer.json and config file then download that git repository .zip file and extract that in vendor directory at appropiate path – Ravi Damasiya Nov 09 '21 at 07:26
  • Please share more details. What is the "second method"? Both use Composer, and xyou don't only have to add the line to the `composer.json`, but you also need to call `composer update borales/yii2-phone-input` to properly install the package – Nico Haase Nov 09 '21 at 07:33
  • Also, be warned that the package hasn't seen any updates since more than two years. Probably it won't work with your application – Nico Haase Nov 09 '21 at 07:34
  • @RaviDamasiya I have done all the steps but still getting the error – Beginner Nov 09 '21 at 07:41
  • @NicoHaase thanks and sorry for the confusion, the second method here refers to adding "borales/yii2-phone-input": "*" to composer.json, my supervisor told not to run any command because it might affect the production server if deploy. If by running composer require/ composer update it works well, that is why he asked to find a way to install without the commands. – Beginner Nov 09 '21 at 07:43
  • No, there's none that is really good. If Composer causes problems on the production server, you need to resolve these problems properly – Nico Haase Nov 09 '21 at 07:45
  • @NicoHaase alright, thanks for the advice. I guess still have to run composer require – Beginner Nov 09 '21 at 08:00
  • 4
    When you run composer it's not only downloading the packages it is also including those packages in its autoloader. If you try to add an package without running composer the autoloader won't be updated and you won't be able to use classes from that package. If you don't want to or can't run the composer on production you can run composer somewhere else then move the whole app to production. This might actually be a better way to deploy app. You can get rid of files that doesn't need to be in production or even shouldn't be there. – Michal Hynčica Nov 09 '21 at 08:42
  • 1
    if you don't want to use composer command then You can download the composer.json & composer.lock from production in a local directory, run the php composer.phar require "borales/yii2-phone-input" "*" command, zip the vendor folder and upload it on the server – Abhishek kandari Nov 09 '21 at 17:59

0 Answers0