Rename the lib folder and the namespace after the project name
Closed this issue · 5 comments
It may be better to name the folder and the namespace after the project name, especially if you have several libs and namespaces.
lib/jblond
to lib/phpdiff
and
use phpdiff\Autoloader;
use phpdiff\Diff;
use phpdiff\Diff\Renderer\Html\SideBySide;
I don't see your point. I can use several libs and it still works fine.
composer require jblond/php-diff
composer require jblond/php-router
Did you encounter any issue?
It is just semantics and only a suggestion. All works well. My point is if the name corresponds with the folder / lib and you sort your libs/namespaces for instance in autoload, it is easier to find, like all other libs:
// ...
lib/hashids/Hashids.php Hashids\Hashids
lib/hashids/HashidsInterface.php Hashids\HashidsInterface
lib/hashids/Math/Bc.php Hashids\Math\Bc
lib/hashids/Math/Gmp.php Hashids\Math\Gmp
lib/hashids/Math/MathInterface.php Hashids\Math\MathInterface
lib/php-diff/Diff.php PHPDiff\Diff
lib/php-diff/Diff/Renderer/Html/HtmlArray.php PHPDiff\Diff\Renderer\Html\HtmlArray
lib/php-diff/Diff/Renderer/Html/Inline.php PHPDiff\Diff\Renderer\Html\Inline
lib/php-diff/Diff/Renderer/Html/SideBySide.php PHPDiff\Diff\Renderer\Html\SideBySide
lib/php-diff/Diff/Renderer/Text/Context.php PHPDiff\Diff\Renderer\Text\Context
lib/php-diff/Diff/Renderer/Text/Unified.php PHPDiff\Diff\Renderer\Text\Unified
lib/php-diff/Diff/Renderer/RendererAbstract.php PHPDiff\Diff\Renderer\RendererAbstract
lib/php-diff/Diff/SequenceMatcher.php PHPDiff\Diff\SequenceMatcher
lib/phpmailer/src/Exception.php PHPMailer\PHPMailer\Exception
lib/phpmailer/src/PHPMailer.php PHPMailer\PHPMailer\PHPMailer
lib/phpmailer/src/POP3.php PHPMailer\PHPMailer\POP3
lib/phpmailer/src/SMTP.php PHPMailer\PHPMailer\SMTP
// ...
Not a technical issue.
I see you point now.
vendor/jblond/php-diff/lib/jblond/Diff.php
vs
vendor/phpmailer/phpmailer/src/Exception.php
I think about it.
I looked at it and with composer 2.0 it won't work. Since it needs to be valid PSR-0 / PSR-4 class configuration. Otherwise in optimized-autoloader mode it won't load.