$psr4 Namespace Paths |
i've also been playing with namespace to use things like PHPmailer and my own classes. All i an tell you is what works for me.
So this is my dev structure in a directory called CI located at : /var/www/htdocs bash-5.0$ tree -f -L 1 . ├── ./CODE_OF_CONDUCT.md ├── ./CONTRIBUTING.md ├── ./DCO.txt ├── ./PHPMailer ├── ./PULL_REQUEST_TEMPLATE.md ├── ./README.md ├── ./Vagrantfile.dist ├── ./admin ├── ./app ├── ./composer.json ├── ./composer.lock ├── ./contributing ├── ./env ├── ./fontawesome ├── ./forms ├── ./gulpfile.js ├── ./license.txt ├── ./node_modules ├── ./package-lock.json ├── ./package.json ├── ./phpunit.xml.dist ├── ./public ├── ./scss ├── ./spark ├── ./stale.yml ├── ./system ├── ./tests ├── ./user_guide_src └── ./writable to put it simply PHPMailer is at same level of app the name space of PHPMailer classes including Exception, SMTP , POP is: namespace PHPMailer\PHPMailer; to use PHPMailer from a controller i listed it in app/config/autoload $psrf = [ section as: 'PHPMailer\\PHPMailer'=> ROOTPATH.'PHPMailer/src' then in a controller called sendmail i used: Code: <?php namespace App\Controllers; so as insiteFX just said everything under app uses ,APP namespace but if you follow my approach you will see that I put PHPMailer outside app and it definitely takes notice . |
Messages In This Thread |
$psr4 Namespace Paths - by Gary - 02-24-2020, 05:57 AM
RE: $psr4 Namespace Paths - by InsiteFX - 02-24-2020, 08:55 AM
RE: $psr4 Namespace Paths - by captain-sensible - 02-24-2020, 11:15 AM
RE: $psr4 Namespace Paths - by Gary - 04-13-2020, 12:11 PM
|