Create package that works without composer?

Hello, after a question of a user on IRC ( )

The question stay in my mind, how can we work without composer.

So shouldn’t we try to build release that are independant of composer? With a simple autoloader file? It’s not so complicated and it can help people.

So let’s speak about it

Hello :slight_smile:,

Actually, Hoa has an autoloader. It is always loaded, most of the time avec Composer’s one, to catch flex entities (i.e. Hoa\X\Y is unfolded into Hoa\X\Y\Y if it does not exist).

This autoloader belongs to the Hoa\Consistency library.

To manually include Hoa without Composer, you have to retrieve all the dependencies by yourself, and then:

require '…/Consistency/Prelude.php';

That’s it. If you would like the hoa:// protocol, you have to add defined in the Hoa\Protocol library:

require '…/Protocol/Wrapper.php';

Basically, all you have to do, is to manually load the files that are automatically loaded by Composer. These are very few. To retrieve them:

$ ag 'files": \[' */composer.json
[1] 38:        "files": ["Prelude.php"]

[2] 35:        "files": [ "Socket.php" ]

[3] 36:        "files": ["Wrapper.php"]

[4] 44:        "files": ["Socket.php"]

we have only 4 files, for respectively Hoa\Consistency, Hoa\Irc, Hoa\Protocol and Hoa\Websocket. For consistency and protocol, there are mandatory most of the time. For IRC and WebSocket, this is for the irc:// and ws:// support, so not mandatory whilst being very useful.

However, Composer catches all the version issues. Even if we are in rolling-release and that every master branch will work, you may encounter some surprises.

What do you think we should do? Documenting this side-installation?

yes documenting this installation mode would really be a plus.

I guess we should document it on the Source.html page page instead of the, agree?

It should be accessible from the readme and the documentation of the package in a link called ‘how to install’ that refere to the documentation. the source page is a good choice.

We already have this sentence:

For more installation procedures, please read the Source page.

I guess it is safe enough to only add a new procedure on the source page directly without touching the README.mds.

Please, open an issue (or a PR!) on the W3 repository.