×

Please Login or Register to continue.

3
(5.4K Views)

I am working on a project. I want to integrate PHPMailer into this project. I downloaded PHPMailer and extracted it into a folder.

I am following the instruction on Github PHPMailer. On Github, there are instructions with simple code. Now, I have to install composer using the command line mentioned on Github - 

composer require phpmailer/phpmailer

 I am using this command link on the command prompt. I am getting an error - 

'composer' is not recognized as an internal or external command,
operable program or batch file.

I am doing everything correctly but why am I getting this error - 

'composer' is not recognized as an internal or external command,
operable program or batch file. 

I want to install composer for PHPMailer. 

(2.4K Points)
in PHP

Share

2 Answers
(3.4K Points)
(edited)
2

If you are integrating the PHPMailer library then you will get this error or issue. Let's understand this error. 

'composer' is not recognized as an internal or external command,
operable program or batch file. 

It indicates that the composer is not installed on your local computer. You have to install the composer first to run this command. 

composer require phpmailer/phpmailer

I think you are working on localhost. You have to install the composer Exe file on your local computer to install the composer via the command line in the project path. 

First of all, download the composer.exe file and install it on your computer. 

Install composer for PHPMailer

Kindly must check the command line path. I was using the xampp server. If you are using the xampp server then check the same path and click on next or if you are using another server then set your complete path to 

php\php.exe file. You can see it in the image above. 

Then click on next and complete the installation till the end. 

Now, run a command in the same folder where the PHPMailer folder is available. 
1.    Search run on your computer and enter cmd. 

Run Command Line
2.    After this, a command prompt will open. 
3.    Here, you have to move the project directory. 
Like -  Commands 
cd c:\
Now you are in c drive.
cd xampp\htdocs\smtp
Here, SMTP is a project folder name. You can set your project folder where the PHPMailer library is available. 
Now, run a command to install the composer 

composer require phpmailer/phpmailer

How to install composer using command for PHP Mailer

In this way, you can remove this composer error. 

How to send email using PHP Mailer library and hosting SMTP

 


Comment

(9.4K Points)
1

I know this is your first attempt. I was getting the same composer issue while integrating PHPMailer into the PHP website.

'composer' is not recognized as an internal or external command. 

It means the composer program or any application is not in your machine. It's a common error.  If the composer is not available on your computer then you will get this " 'composer' is not recognized " error on the command prompt. 

You have to install the composer before executing the command. 

Search on google Get Composer or download by link - Get Composer 

Download the composer-setup.exe file and install it on your computer. 

Now, you can run your command and install composer for vendor/autolod.php. 

 

 

 


Comment

    Featured Items:-


    Certificate and Marksheet system with verification & Franchise in PHP

    $75



    Certificate system in PHP website | PHP scripts

    $22



    Home Credito loan finance management multipurpose system in PHP

    $65




    Your Answer

    You can post your answer after login..

    Live Chat

    Hello! How can we assist you today?