Uh oh!
There was an error while loading. Please reload this page.
Convert autoloading to PSR-4 and use composer's autoload - #52
Conversation
cmb69
commented
Jul 29, 2021
AFAIK, PDF rendering had been retired for practical purposes many years ago. I don't see much point in reviving it. I'm slightly concerned about a PHP 8.0 requirement. Is our build machine on that version already? |
Girgias
commented
Jul 29, 2021
The only reason why I bumped it to PHP 8 was because of the abstract folder name which can't be used in a namespace before PHP 8, renaming this folder should do the trick. I'll do that when I get back to this because I was more concerned with getting this running first. |
Uh oh!
There was an error while loading. Please reload this page.
cmb69
commented
Jul 30, 2021
Are there any objections to merge this? |
kocsismate
commented
Jul 30, 2021
There's none from my side, of course :) I only have just one issue: it would be nice if my other PR could be merged in advance, so that conflicts are avoided |
salathe
commented
Jul 30, 2021
Am I correct in understanding that in order to render docs after this PR, we'd have to run some |
Girgias
commented
Jul 30, 2021
Just |
This requires to bump to PHP 8.0 so that 'Abstract' can be used in a namespace This might give us better IDE support and better ways to setup testing...
Command used: php render.php --docbook ../base/.manual.xml --package PHP --format xhtml
Turns out we need the php-src test-runner....
This allows to drop the version back down to PHP 5.6 (due to 'use function')
| <div class="classsynopsisinfo"> | ||
| <span class="ooclass"> | ||
| <strong class="classname">SplStack</strong> | ||
| <span class="modifier">class</span> <strong class="classname"><strong class="classname">SplStack</strong></strong> |
There was a problem hiding this comment.
@kocsismate seems #50 inserts a redundant strong tag (and possibly whitespace)
What is the benefit of using Composer? I think there was a discussion about using Composer in the past but I was not part of it. Can someone summarize why do we need Composer in PHD? If we don't need composer then we can use the built-in autoloader. But I am generally in favor of moving from PSR-0 to PSR-4 |
Girgias
commented
Jul 30, 2021
Mainly because we need testing, and the current tests depend on the php-src test runner, which is far from ideal as there is no easy way to pull it in for CI, and the two reasonable options I see is to either make php-src's test runner a separate repo and a project that we can pull in via Composer, or migrate to PHPUnit which we need to pull in via Composer. Composer is the de facto package manager in PHP and using it seems far from controversial. Moreover, it could allow us to pull in some packages to improve the codebase, like a DI container. If the issue of running a script is on the infra side we could add the |
kamil-tekiela
commented
Jul 30, 2021
So that was my next question. If we merge this, won't the nightly job on php.net fail due to missing |
Ok. Then I maintain my objection. If this PR gets merged as-is, someone is going to have go through all of the "documentation", which is spread far and wide, to change the "how to use PhD" instructions. Also, someone is going to have to install composer, make sure it keeps up-to-date, change build steps, etc. on at least the two php.net machines that are building the docs. Back to problems that can be fixed today: rendering the docs from this PR has a few problems...
For example (showing both of these problems): I also tried (because my memory is like a sieve these days) How thoroughly have these changes been exercised / tested? Because basic commands like above should not be failing. |
Girgias
commented
Jul 30, 2021
So this issue can be by-passed by adding the
Obviously the testing is lacking because our test suite is lacking, so if you remember a list of commands that should work (or can point me to where to find them) I can manually test them. But thanks for spotting these issues. |
kamil-tekiela
commented
Jul 30, 2021
In the current state, yes. I just pulled the PR to my machine and it lit up in red... so I think I am missing some commits. I'd much rather see this PR split into smaller chunks. First, move from PSR-0 to PSR-4 and make sure that everything still works. Then if people have no objections to changing the build tools, we can implement Composer autoloading. I also agree that we should probably remove some of this functionality before we attempt larger refactoring like this, as there's no point in maintaining functionality that is not in use. |
Girgias
commented
Jul 30, 2021
I'm not sure there is much point in changing the autoloading standard if it's not to use the Composer one, this PR is basically just this move to PSR-4, and the issues causes by function defs is because of the namespace requirements of PSR-4.
This can be done now as a separate PR. |
Girgias
commented
Jul 30, 2021
@salathe I think I've fixed all of the issues and concerns, can I get your opinion on this again? |
cmb69
commented
Jul 30, 2021
Wouldn't having vendor/ pre-installed imply that one must use a certain PHP version? |
kamil-tekiela
commented
Jul 30, 2021
kocsismate
commented
Jul 30, 2021
AFAIK, no, as long as the PHP version requirement is satisfied. |
highlight_string() does not throw and even if it did it would throw an Exception which exists
afilina
commented
Oct 16, 2025
@Girgias How much of this is still relevant today, considering the project is compatible with 8.1+, uses Composer, and seems to be mostly PSR-4. |
Girgias
commented
Nov 4, 2025
Do we use the composer autoload now? If not then this is still somewhat relevant, otherwise can be closed. |
afilina
commented
Nov 4, 2025
@Girgias There's no reference to autoload.php in the codebase.
Could you point out exactly which part is relevant in this context? I feel like the merge conflicts are too severe to try and do something with this diff. But we could convert it to an issue with a specific request. |
Girgias
commented
Jan 11, 2026
Superseded by #229 |

This requires to bump to PHP 8.0 so that 'Abstract' can be used in a namespace
This might give us better IDE support and better ways to setup testing...
I tried to test this by running it but I can't figure out which command I am meant to enter so I'm hitting issues with trying to render PDF which is expecting the Haru extension to be loaded.... which has been abandoned for ages.
For reference the command I entered is:
php render.php -d ../base/.manual.xml -P PHP