meta_package_manager.managers.pear module¶
- meta_package_manager.managers.pear.RELEASE_STATES = ('snapshot', 'devel', 'alpha', 'beta', 'stable')¶
The quality states a PEAR release can carry.
Source:
PEAR_Validate::getValidStates()inPEAR/Validate.php, repeated verbatim inPEAR/Common.phpand both REST clients.The listing parsers key on this vocabulary because it is what separates a package row from the table furniture around it: a row ends on one of these lowercase words, while the
PACKAGE VERSION STATEheader ends on an uppercase one and the(no packages installed)placeholder on a parenthesis.
- class meta_package_manager.managers.pear.PEAR[source]¶
Bases:
PackageManagerThe PHP Extension and Application Repository.
PEAR ships with PHP itself and installs libraries into the interpreter’s
php_dir, against its own registry atpear.php.net.Important
Whether that needs root is a property of the PHP install, not of PEAR: a distribution’s
php_diris/usr/share/phpand refuses an ordinary user with Cannot install, php_dir for channel “pear.php.net” is not writable by the current user. So the mutating operations carry privileged markers but leave them dormant, exactly as the other language managers do: mpm –sudo`, or a``[mpm.overrides.pear] sudo = true` entry, escalates them.The better fix is to own the prefix instead. PEAR is fully relocatable, and every role directory has to move together: repointing
php_diralone fails late, onfailed to mkdir /usr/share/php/tests/..., becausetest_diris a separate setting. Withphp_dir,bin_dir,data_dir,test_dir,doc_dir,cfg_dir,www_dir,man_dir,temp_dir,download_dirandcache_dirall under one writable prefix, an install needs no privilege at all.Caution
Every network operation costs one REST round-trip per package, and
pear.php.netanswers slowly:outdatedmeasured 63 seconds warm and 105 seconds cold against a host carrying only six packages, so it approaches mpm’s 120-second read-only cap on an inventory barely larger. Raisempm --timeouton a host with more.installedis unaffected, reading the local registry with no network at all.Note
searchis not implemented.pear searchresolves through the same per-package REST walk (PEAR_REST_10::listAll()with its$basicparameter false, onep/<name>/info.xmlfetch apiece), and no run of it here ever returned: two attempts were abandoned after 15 and 30 minutes, the second having reached “50%”.remote-listis no way around it either, costing 524 seconds on a cold cache. Both are far past the read-only cap, so mpm skips the operation andinstallfalls through to installing the named package directly.Note
A package is reported under its bare name, the spelling
pear installtakes. PEAR identities are really channel-qualified ([channel/]package), so two channels shipping the same name would collapse onto one entry; in practicepear.php.netis the only populated one.Documentation: PEAR manual.
Initialize
cli_errorslist.- homepage_url: str | None = 'https://pear.php.net'¶
Home page of the project, only used in documentation for reference.
- logo: str | None = 'php'¶
Slug of the brand mark standing for this manager in the documentation.
Names an SVG vendored under
docs/assets/managers/, whose provenance and license are recorded indocs/assets/managers/logos.yaml. Inlined at the top of the manager’s page bymeta_package_manager._docs; a manager leaving it unset keeps the page’s default package glyph.Several managers legitimately share one slug, either because they wrap the same upstream (
brewandcask) or because the tool has no mark of its own and its ecosystem’s stands in (aptunder Debian’s swirl,cargounder Rust’s gear). Documentation-only, likehomepage_url: no CLI output reads it.
- platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='aix', name='IBM AIX'), Platform(id='almalinux', name='AlmaLinux'), Platform(id='alpine', name='Alpine Linux'), Platform(id='altlinux', name='ALT Linux'), Platform(id='amzn', name='Amazon Linux'), Platform(id='android', name='Android'), Platform(id='arch', name='Arch Linux'), Platform(id='buildroot', name='Buildroot'), Platform(id='cachyos', name='CachyOS'), Platform(id='centos', name='CentOS'), Platform(id='chromeos', name='ChromeOS'), Platform(id='clearlinux', name='Clear Linux OS'), Platform(id='cloudlinux', name='CloudLinux OS'), Platform(id='crux', name='CRUX'), Platform(id='cygwin', name='Cygwin'), Platform(id='debian', name='Debian'), Platform(id='dragonfly_bsd', name='DragonFly BSD'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='freebsd', name='FreeBSD'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='haiku', name='Haiku'), Platform(id='hurd', name='GNU/Hurd'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='illumos', name='illumos'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='macos', name='macOS'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='midnightbsd', name='MidnightBSD'), Platform(id='netbsd', name='NetBSD'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='nutyx', name='NuTyX'), Platform(id='openbsd', name='OpenBSD'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='os400', name='IBM i'), Platform(id='parallels', name='Parallels'), Platform(id='pidora', name='Pidora'), Platform(id='pikaos', name='PikaOS'), Platform(id='raspbian', name='Raspbian'), Platform(id='rhel', name='RedHat Enterprise Linux'), Platform(id='rocky', name='Rocky Linux'), Platform(id='scientific', name='Scientific Linux'), Platform(id='slackware', name='Slackware'), Platform(id='sles', name='SUSE Linux Enterprise Server'), Platform(id='slitaz', name='SliTaz GNU/Linux'), Platform(id='solaris', name='Solaris'), Platform(id='solus', name='Solus'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='sunos', name='SunOS'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='windows', name='Windows'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})¶
List of platforms supported by the manager.
Allows for a mishmash of platforms and groups of platforms. Will be normalized into a
frozensetofPlatforminstances at instantiation.
- requirement: str | None = '>=1.10.0'¶
The series every current distribution ships, and the one upstream still releases from (
1.10.18, 2026-01-25).A conservative floor rather than a feature bisect: every verb driven here is older, the bare
upgradedelegation todoUpgradeAllbeing present already in1.9.5.
- version_cli_options: tuple[str, ...] = ('version',)¶
pear --versionis not a thing: it is rejected as Command ‘–version’ is not valid`, and the version comes from the``version` verb instead.
- version_regexes: tuple[str, ...] = ('PEAR Version:\\s+(?P<version>\\S+)',)¶
$ pear version PEAR Version: 1.10.16 PHP Version: 8.4.24 Zend Engine Version: 4.4.24 Running on: Linux debian 6.12.94+deb13-arm64 #1 SMP Debian 6.12.94-1 (2026-06-20) aarch64
- property installed: Iterator[Package]¶
Fetch installed packages.
--allchannelsis not optional: a barepear listreports the default channel alone and silently omits everything installed from any other. The listing is a section per channel, and the parser keeps only the rows closing on a release state.$ pear list --allchannels INSTALLED PACKAGES, CHANNEL __URI: ================================== (no packages installed) INSTALLED PACKAGES, CHANNEL DOC.PHP.NET: ======================================== (no packages installed) INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET: ========================================= PACKAGE VERSION STATE Archive_Tar 1.5.0 stable Console_Getopt 1.4.3 stable PEAR 1.10.16 stable PEAR_Manpages 1.10.0 stable Structures_Graph 1.2.0 stable XML_Util 1.4.5 stable INSTALLED PACKAGES, CHANNEL PECL.PHP.NET: ========================================= (no packages installed)
- property outdated: Iterator[Package]¶
Fetch outdated packages.
list-upgradeswalks every registered channel on its own, so it takes no--allchannels. Each version column carries its release state in parentheses, which is what tells a package row from the header above it.$ pear list-upgrades PEAR.PHP.NET AVAILABLE UPGRADES (STABLE): ========================================= CHANNEL PACKAGE LOCAL REMOTE SIZE pear.php.net Archive_Tar 1.5.0 (stable) 1.6.0 (stable) 22kB pear.php.net PEAR 1.10.16 (stable) 1.10.18 (stable) 288kB
- install(package_id, version=None)[source]¶
Install one package.
A version is appended to the name with a dash, the
Package-1.1form PEAR’s owninstallhelp documents. PEAR package names use underscores, so the dash never collides with one.$ pear install Text_Password downloading Text_Password-1.2.1.tgz ... Starting to download Text_Password-1.2.1.tgz (5,631 bytes) .....done: 5,631 bytes install ok: channel://pear.php.net/Text_Password-1.2.1
$ pear install Text_Password-1.2.1 Starting to download Text_Password-1.2.1.tgz (5,631 bytes) .....done: 5,631 bytes install ok: channel://pear.php.net/Text_Password-1.2.1
- Return type:
- upgrade_all_cli()[source]¶
Generates the CLI to upgrade all outdated packages.
upgradewith no package named is the documented spelling: the separateupgrade-allverb still exists but announces itself as deprecated in favour of this one, and both land on the samedoUpgradeAllhandler.Caution
PEAR is itself a PEAR package, so an upgrade of everything replaces the tool along with the libraries it manages.
$ pear upgrade
- cli_names: tuple[str, ...] = ('pear',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- id: str = 'pear'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- upgrade_one_cli(package_id, version=None)[source]¶
Generates the CLI to upgrade the provided package.
$ pear upgrade Text_Password
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- remove(package_id)[source]¶
Remove one package.
$ pear uninstall Text_Password uninstall ok: channel://pear.php.net/Text_Password-1.2.1
- Return type:
- sync()[source]¶
Sync package metadata.
Refreshes the definition of every registered channel. A channel whose server answers badly is reported and stepped over, the run still exiting
0.$ pear update-channels Updating channel "doc.php.net" Error: Unable to create XML parser Invalid channel.xml file Updating channel "pear.php.net" Channel "pear.php.net" is up to date Updating channel "pecl.php.net" Update of Channel "pecl.php.net" succeeded
- Return type: