CodeIgniter libraries are collection of classes located in libraries folder(i.e, application/libraries and system/libraries). Libraries are used to make the collection of related methods. You can make as many libraries in CodeIgniter as per your convenience.
Let’s start the tutorial for create custom library in CodeIgniter. Visit here:- ... OP will provide real link, please ...

Considering that CI4 will be installed via composer: you can create your libraries without worrying about codeigniter methods and then upload your library to packagist. From within your codeigniter directory, composer require "companyName/yourLibrary" and then voila.