I'm afraid you misunderstood what Composer is and what installing it globally means. Composer is a tool for installing dependencies in your project. Installing it globally means that you can use this tool from any place in your system, but it doesn't mean that it will magically resolve all dependencies from all of your project - you need to call Composer manually to declare and install required dependencies.
So if you have composer.json
file in /Applications/XAMPP/xamppfiles/htdocs/emailexample
you should go into your project directory and install required dependencies:
cd /Applications/XAMPP/xamppfiles/htdocs/emailexample
composer install
If you don't have composer.json
you need to define your dependencies first. You can read more about it in documentation, and dependencies should be defined in source of your "mail php example" project. But in general you can add dependencies by:
cd /Applications/XAMPP/xamppfiles/htdocs/emailexample
composer require package/name
Where package/name
is name of dependency - you should replace it with real name.
After installing dependencies make sure that you include composer autoloader in your index.php
- you should have something like this before using any class:
require_once __DIR__ . '/vendor/autoload.php':
composer update
command – prit.patelvendor
directory in/Applications/XAMPP/xamppfiles/htdocs/emailexample
? – rob006