Download the PHP package ju1ius/fusbup without Composer
On this page you can find all versions of the php package ju1ius/fusbup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ju1ius/fusbup
More information about ju1ius/fusbup
Files in ju1ius/fusbup
Package fusbup
Short Description A fast & memory-efficient interface to the Mozilla Public Suffix List.
License MIT
Informations about the package fusbup
souplette/fusbup
A fast and memory-efficient PHP library to query the Mozilla public suffix list.
Installation
Basic usage
Querying effective top-level domains (eTLD)
Querying registrable domains (AKA eTLD+1)
Checking the applicability of a cookie domain
The PublicSuffixList
class implements the
RFC6265 algorithm
for matching a cookie domain against a request domain.
Internationalized domain names
All PublicSuffixList
methods that return domains
return them in their normalized ASCII form.
Performance
The public suffix list contains about 10 000 rules as of 2023.
In order to be maximally efficient for all uses cases,
the PublicSuffixList
class can use two search algorithms
with different performance characteristics.
The first one (and the default) uses a DAFSA compiled to a binary string (this is the algorithm used in the Gecko and Chromium engines). The second one uses a compressed suffix tree compiled to PHP code.
Here is a summary of their respective pros and cons:
- DAFSA
- ð more memory efficient (this is just a 50Kb string in memory)
- ð faster to load (around 20Ξs on a SSD)
- ð slower to search (in the order of 100 000 ops/sec)
- Suffix tree
- ð less memory efficient (about 4Mb in memory)
- ð slower to load (around 4ms without opcache, 500Ξs when using opcache preloading)
- ð faster to search (in the order of 1 000 000 ops/sec)
Note that in both cases, the database will be lazily loaded.
Which search algorithm should I use?
Well, it depends on your use case but based on the aforementioned characteristics I would say: stick to the default (DAFSA) algorithm unless your app is going to make more than a few hundreds searches per seconds.
Tell me how can I use them?
Both algorithm can be used by passing the appropriate loader to the PublicSuffixList
constructor.
DAFSA
Suffix Tree
You should also configure opcache to preload the database:
In your php.ini
:
In your preload script:
All versions of fusbup with dependencies
ext-intl Version *