Documentation: Creating Composer Packages |
(08-01-2023, 12:47 AM)kenjis Wrote:(08-01-2023, 12:23 AM)iRedds Wrote: Did you know that if you register a module in composer.json in the autoload section, the short config name won't work? But it's you who added the code that takes the installed packages and the namespaces registered in the composer, and if there are no matches in the paths, then the namespace is discarded. https://github.com/codeigniter4/CodeIgni...5a0433be18
@iRedds I cannot reproduce that the short config name won't work.
Can you show steps to reproduce? I was able to get the MyConfig object. PHP Code: <?php PHP Code: <?php Code: "autoload": { Code: $ php spark namespaces
@kenjis I think the package developer should think ahead about the namespace name. So to speak, a test of maturity.
@kenjis I placed the module in the vendor directory. That is, if "Acme\\" : "vendor/Acme/" - class autoloading works but short config name is not present and also Acme namespace is not visible via "php spark namespaces" command. "Acme\\" : "Acme/" - everything works as expected. Why did I specify vendor/Acme/? If the developer can use the composer locally, but not on the server (that is, the developer stores the vendor directory in the repository and copies it to the server), then in this case he may well place his module in the vendor directory. I believe that there should be no such restriction. @luckmoshy Yes, I may be biased. Like most of the core team. =) (08-01-2023, 01:38 AM)iRedds Wrote: @kenjis I placed the module in the vendor directory. Okay, I got what you say. We assume all packages in vendor/ are Composer packages (installed by composer), and auto-discovery searches files in Composer package namespaces. So your way does not work. I think your way is a misuse, because Composer controls under vendor/. If you put the module in vendor/, you should install it via composer.
(08-01-2023, 07:01 PM)kenjis Wrote: @sammyskills Great, thanks for the good work. |
Welcome Guest, Not a member yet? Register Sign In |