3

I have a project with PHP 7.3, under Windows 10. I use the PHP from Xampp.

I get the following error:

Fatal error: Uncaught Error: Class 'SplEnum' not found in [...]

for

class BanLevel extends SplEnum { ... } 

It seems I am misunderstanding the docu:

  1. https://www.php.net/manual/en/class.splenum.php
  2. https://www.php.net/manual/en/spl.installation.php

This gives me the idea it should be included in my PHP artefact.

What am I missing?

UPDATE: The class.splenum.php page has gone offline. It is still available in Romanian, though:
https://www.php.net/manual/ro/class.splenum.php, or here:
https://php-legacy-docs.zend.com/manual/php5/en/class.splenum

0

2 Answers 2

3

It seems I checked the wrong documentation,
this is the right one:
https://www.php.net/manual/en/spl-types.installation.php

It clarifies:

This PECL extension is not bundled with PHP.

A DLL for this PECL extension is currently unavailable.

So I can't use SPLEnum under Windows, except I compile it into PHP.

UPDATE:

The spl-types.installation.php page does not exist on php.net anymore, but it is still available here:
https://php-legacy-docs.zend.com/manual/php5/en/spl-types.installation

Sign up to request clarification or add additional context in comments.

3 Comments

@dbc Thanks for the info! I can't find any replacement for that documentation anywhere, just the Romanian version is still online: php.net/manual/ro/spl-types.installation.php
It seems, the SPL Types package was replaced by the SPL package?
0

2025 Update

SplEnum is no longer maintained, but you can still use it via a polyfill I wrote: aldemeery/enum-polyfill.

No need to install the old PECL extension—just run:

composer require aldemeery/enum-polyfill 

Your existing SplEnum code will work immediately.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.