What is the best practice for including external libraries like Smarty in PHP scripts?

When including external libraries like Smarty in PHP scripts, it is best practice to use Composer, a dependency manager for PHP. Composer allows you to easily manage and autoload external libraries in your project. By using Composer, you can ensure that your external libraries are kept up to date and efficiently integrated into your PHP scripts.

// Require Composer's autoloader
require 'vendor/autoload.php';

// Use the Smarty namespace to instantiate the Smarty object
$smarty = new Smarty();
$smarty->assign('name', 'John Doe');
$smarty->display('index.tpl');