Download the PHP package rollerworks/pdb-symfony-bridge without Composer
On this page you can find all versions of the php package rollerworks/pdb-symfony-bridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rollerworks/pdb-symfony-bridge
More information about rollerworks/pdb-symfony-bridge
Files in rollerworks/pdb-symfony-bridge
Package pdb-symfony-bridge
Short Description PHP domain-parser Bridge for Symfony Cache, HTTP Client and FrameworkBundle (optional)
License MIT
Informations about the package pdb-symfony-bridge
PHP Domain Parser Symfony-bridge
This package provides a Symfony specific bridge for the PHP domain-parser by Jeremy Kendall and Ignace Nyamagana Butera.
Providing a Cache adapter, HTTP Client adapter, and optional FrameworkBundle
integration at Rollerworks\Component\PdbSfBridge\Bundle\RollerworksPdbBundle
.
Installation
To install this package, add rollerworks/pdb-symfony-bridge
to your composer.json:
Now, Composer will automatically download all required files, and install them for you.
Symfony Flex (with contrib) is assumed to enable the Bundle and add required configuration. https://symfony.com/doc/current/bundles.html
Otherwise add the following configuration:
Requirements
You need at least PHP 8.1, and internet access is recommended but not required.
The public-suffix and top-level domain needs to manually updated from time to time. When internet access is available the PdbManager will automatically download the list and store it in the cache.
If no internet access is available, the local cache needs to refreshed manually. (Current not supported yet).
Basic Usage
Use the HttpUpdatedPdpManager
to get a PdbManager which automatically updates
the local cache using the HttpClient.
When internet access is not possible use the StaticPdpManager
instead.
For resolving domain names see the official documentation of [PHP domain-parser].
Testing
For using the manager in tests use
\Rollerworks\Component\PdbSfBridge\PdpMockProvider::getPdpManager()
.
Bundle Usage
First add set a suitable cache adapter (the Flex recipe uses ArrayCache
to allow
booting-up the Kernel, but for production usage it's required to use a persistent
cache adapter, as otherwise whenever the Manager is initialized the rules need to
be downloaded, parsed and cached).
Offline usage
When the HttpClient component is installed and enabled the HttpUpdatedPdpManager
is automatically used. When the HttpClient is not available the StaticPdpManager
is used instead.
_To force usage of the static adapter set configuration rollerworks_pdb.manager
to static
._
When the static adapter is enabled you must run rollerworks-pdb:update
with
the lists provided as files names.
And disable expiration of the cache, as otherwise the pre-bundled version will be used instead.
First download the lists from https://publicsuffix.org/list/public_suffix_list.dat and https://data.iana.org/TLD/tlds-alpha-by-domain.txt respectively.
And load them into the cache.
The files path can be either absolute or relative to the current working directory.
Cache expiration disable: Symfony cache-warming is designed as such that once the cache is warmed-up no future file writing is expected (for security reasons).
Which is why the cache should be easily updatable, with preferable no filesystem writing.
The rollerworks-pdb:update
updates the cache without writing the provided files
to the application var/cache directory. So when the cache does expire, there would
be no files to read from, to prevent this the pre-bundled lists (used for the MockManager
)
are used instead, but these are only updated from time to time, and thus outdated.
Versioning
For transparency and insight into the release cycle, and for striving to maintain backward compatibility, this package is maintained under the Semantic Versioning guidelines as much as possible.
Releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bumps the patch
For more information on SemVer, please visit http://semver.org/.
License
This library is released under the MIT license.
Contributing
This is an open source project. If you'd like to contribute, please read the Contributing Guidelines. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section.
All versions of pdb-symfony-bridge with dependencies
jeremykendall/php-domain-parser Version ^6.3
psr/simple-cache Version ^1.0 || ^3.0
symfony/cache Version ^6.3 || ^7.0