including-the-files.rst 1.0KB

12345678910111213141516171819202122232425262728293031
  1. Including Swift Mailer (Autoloading)
  2. ====================================
  3. Swift Mailer uses an auto-loader so the only file you need to include is the
  4. ``lib/swift_required.php`` file.
  5. To use Swift Mailer's autoloader:
  6. * Put Swift Mailer somewhere accessible to your PHP scripts (this does not
  7. need to be in the web root).
  8. * Include, or require the ``lib/swift_required.php`` file.
  9. * Follow the remainder of the documentation for using the available
  10. components.
  11. .. note::
  12. While Swift Mailer's autoloader is designed to play nicely with other
  13. autoloaders, sometimes you may have a need to avoid using Swift Mailer's
  14. autoloader and use your own instead. Include the ``swift_init.php``
  15. instead of the ``swift_required.php`` if you need to do this. The very
  16. minimum include is the ``swift_init.php`` file since Swift Mailer will not
  17. work without the dependency injection this file sets up:
  18. .. code-block:: php
  19. require_once '/path/to/swift-mailer/lib/swift_required.php';
  20. /* rest of code goes here */