CodeIgniter Forums
Documentation: Creating Composer Packages - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Documentation: Creating Composer Packages (/showthread.php?tid=88163)

Pages: 1 2


Documentation: Creating Composer Packages - kenjis - 07-31-2023

We will add the new documentation about Creating Composer Packages.
https://codeigniter4.github.io/CodeIgniter4/extending/composer_packages.html

If you have any suggestion or question, feedback is welcome.


RE: Documentation: Creating Composer Packages - iRedds - 07-31-2023

In my opinion, this is the most useless thing that could be invented.
I mean that such a manual has a place in an article on some resource and without reference to CI coding standards.

In such a "guide" I would be primarily interested in the type of license. What are and which is better to choose.


RE: Documentation: Creating Composer Packages - nc03061981 - 07-31-2023

Thanks for guide


RE: Documentation: Creating Composer Packages - kenjis - 07-31-2023

@iRedds Is there any good article for beginners to create Composer packages?

My intent is to explain things for CI4:
https://codeigniter4.github.io/CodeIgniter4/extending/composer_packages.html#config-files
Because I did not know that well.

Also, I want to let people to know that you should use your package vendor name as your vendor namespace.
Some developers mistakenly believe that they are free to name vendor namespaces independently of the package name.


RE: Documentation: Creating Composer Packages - kenjis - 07-31-2023

(07-31-2023, 03:29 AM)iRedds Wrote: In such a "guide" I would be primarily interested in the type of license. What are and which is better to choose.

Use MIT, if you don't have a strong opinion.
Because it is most commonly used in the PHP world, and no conflicts with other Open Source Licenses.

For example, if you want to prohibit a large company such as Google from modifying and using your packages, you should choose the GNU AGPLv3.

See https://choosealicense.com/


RE: Documentation: Creating Composer Packages - luckmoshy - 07-31-2023

@iRedds I argue that your opinion is really biased I personally take this as very interesting since it helps newbies in CI sometimes to learn how they can integrate their third-party modules or packages with the composer in CI because the main intent is to give Ideas or teach CI users how they can appropriately deal with Composer in Ci with their third party composer packages and this can also do a lot includes Lincences so this is very interesting really and so on as you asked before


RE: Documentation: Creating Composer Packages - InsiteFX - 07-31-2023

I also think that this is a good idea, I have seen that alot of the users are just using the folder Modules insteand
of their own Namespace name like InsiteFX/Modules.


RE: Documentation: Creating Composer Packages - sammyskills - 07-31-2023

I believe this is a great idea, as it will serve as a guide to developers wanting to create custom packages.

For example, WordPress has a developer handbook for custom plugins and themes, which guide developers on how to create custom plugins and themes. Though it is totally not compulsory to follow the coding standards and folder structure, it is necessary if a developer wants to submit their plugin/theme to the WordPress directory, and for better collaboration from other WordPress developers.

I suggest that a link to the choosing a license should be added to the page too, to help developers choose their preferred license.


RE: Documentation: Creating Composer Packages - iRedds - 08-01-2023

(07-31-2023, 05:12 PM)kenjis Wrote: @iRedds Is there any good article for beginners to create Composer packages?
Google?

(07-31-2023, 05:12 PM)kenjis Wrote: My intent is to explain things for CI4:
https://codeigniter4.github.io/CodeIgniter4/extending/composer_packages.html#config-files
Because I did not know that well.

Did you know that if you register a module in composer.json in the autoload section, the short config name won't work?
Since only modules registered in the Autoload config and installed via `composer require` are allowed.

(07-31-2023, 05:12 PM)kenjis Wrote: Also, I want to let people to know that you should use your package vendor name as your vendor namespace.
Some developers mistakenly believe that they are free to name vendor namespaces independently of the package name.

I can't find any information that says the namespace should be the name of the vendor.

What do you say about it?

vendor name | namespace
fakerphp | Faker
mikey179 | org\bovigo\vfs
myclabs | DeepCopy
nikic | PhpParser

And these are just the packages used in codeigniter4/appstarter.

The most important. codeigniter4 | CodeIgniter


RE: Documentation: Creating Composer Packages - kenjis - 08-01-2023

(08-01-2023, 12:23 AM)iRedds Wrote: I can't find any information that says the namespace should be the name of the vendor.

What do you say about it?

vendor name | namespace
fakerphp      | Faker
mikey179    | org\bovigo\vfs
myclabs        | DeepCopy
nikic            | PhpParser

Misuses.
If we can freely use vendor namespaces, how do we avoid name collision?
How do we know the vendor namespace that is not used?

"codeigniter4 | CodeIgniter" is not the problem, because the organization has the vendor name "codeigniter".
https://packagist.org/packages/codeigniter/