{"id":18937512,"url":"https://github.com/rollerworks/pdbsfbridge","last_synced_at":"2025-08-01T07:12:23.716Z","repository":{"id":205065816,"uuid":"708426096","full_name":"rollerworks/PdbSfBridge","owner":"rollerworks","description":"PBD Bridge for Symfony - Client and Cache ","archived":false,"fork":false,"pushed_at":"2024-01-30T19:57:34.000Z","size":109,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T15:55:44.206Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rollerworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-22T14:30:58.000Z","updated_at":"2023-11-04T15:49:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"203dff6e-0ba7-4700-9cde-1fdf940da450","html_url":"https://github.com/rollerworks/PdbSfBridge","commit_stats":null,"previous_names":["rollerworks/pdbsfbridge"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rollerworks/PdbSfBridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2FPdbSfBridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2FPdbSfBridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2FPdbSfBridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2FPdbSfBridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rollerworks","download_url":"https://codeload.github.com/rollerworks/PdbSfBridge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollerworks%2FPdbSfBridge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268185170,"owners_count":24209381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T12:11:31.519Z","updated_at":"2025-08-01T07:12:23.667Z","avatar_url":"https://github.com/rollerworks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP Domain Parser Symfony-bridge\n================================\n\nThis package provides a Symfony specific bridge for the [PHP domain-parser][pdb]\nby Jeremy Kendall and Ignace Nyamagana Butera.\n\nProviding a Cache adapter, HTTP Client adapter, and optional FrameworkBundle\nintegration at `Rollerworks\\Component\\PdbSfBridge\\Bundle\\RollerworksPdbBundle`.\n\n## Installation\n\nTo install this package, add `rollerworks/pdb-symfony-bridge` to your composer.json:\n\n```bash\n$ php composer.phar require rollerworks/pdb-symfony-bridge\n```\n\nNow, [Composer][composer] will automatically download all required files,\nand install them for you.\n\n[Symfony Flex][flex] (with contrib) is assumed to enable the Bundle and add\nrequired configuration. https://symfony.com/doc/current/bundles.html\n\nOtherwise add the following configuration:\n\n\u003cdetails\u003e\n\n```yaml\nrollerworks_pdb:\n    cache_pool: 'rollerworks.cache.public_prefix_db'\n    #manager: http # either: 'http' (default), 'static' (requires manual updates) or 'mock'\n\nframework:\n    cache:\n        pools:\n            # This name can be changed by setting `rollerworks_pdb.cache_pool` (**Don't reuse an existing cache pool!**)\n            rollerworks.cache.public_prefix_db:\n                adapter: cache.adapter.array # use a persistent adapter that can be easily invalidated like cache.adapter.memcached or cache.adapter.pdo\n                default_lifetime: 604800 # one week, the cache should be automatically refreshed, unless manager=static is used\n```\n\n\u003c/details\u003e\n\n## Requirements\n\nYou need at least PHP 8.1, and internet access is recommended but not required.\n\nThe public-suffix and top-level domain needs to manually updated from time\nto time. When internet access is available the PdbManager will automatically\ndownload the list and store it in the cache.\n\nIf no internet access is available, the local cache needs to refreshed manually.\n(Current not supported yet).\n\n## Basic Usage\n\nUse the `HttpUpdatedPdpManager` to get a PdbManager which automatically updates\nthe local cache using the HttpClient.\n\n```php\n\u003c?php\n\nuse Rollerworks\\Component\\PdbSfBridge\\HttpUpdatedPdpManager;\nuse Symfony\\Component\\Cache\\Psr16Cache(;\n\n// Any PSR16 Compatible adapter can be used, but it's recommended to use\n// A caching adapter that allows easy invalidation (like Pdo or Memcache).\n$cacheAdapter = ...;\n$cache = new Psr16Cache($cacheAdapter);\n\n// Optional, if not provided created as shown\n// $httpClient = new \\Symfony\\Component\\HttpClient\\HttpClient::create();\n\n$manager = HttpUpdatedPdpManager::create($cache, /*$httpClient*/);\n\n// Not required. But recommended to warm-up the caches.\n$manager-\u003eupdateCaches();\n\n// \\Pdp\\PublicSuffixList\n$publicSuffixList = $manager-\u003egetPublicSuffixList();\n\n// \\Pdp\\PublicSuffixList\n$topLevelDomainList = $manager-\u003egetTopLevelDomainList();\n```\n\nWhen internet access is not possible use the `StaticPdpManager` instead.\n\n```php\n\u003c?php\n\nuse Rollerworks\\Component\\PdbSfBridge\\StaticPdpManager;\n\n// Any PSR16 Compatible adapter can be used, but it's recommended to use\n// A caching adapter that allows easy invalidation (like Pdo or Memcache).\n$cacheAdapter = ...;\n$cache = new Psr16Cache($cacheAdapter);\n\n// Provide the lists as described, realpath (not contents are string)\n$publicSuffixList = ...; // File provided from https://publicsuffix.org/list/public_suffix_list.dat\n$topLevelDomainList ...; // File provided from https://data.iana.org/TLD/tlds-alpha-by-domain.txt\n\n$manager = new StaticPdpManager($publicSuffixList, $topLevelDomainList, $cache);\n\n// Not required. But recommended to warm-up the caches.\n$manager-\u003eupdateCaches();\n\n// \\Pdp\\PublicSuffixList\n$publicSuffixList = $manager-\u003egetPublicSuffixList();\n\n// \\Pdp\\PublicSuffixList\n$topLevelDomainList = $manager-\u003egetTopLevelDomainList();\n```\n\nFor resolving domain names see the official documentation of [PHP domain-parser].\n\n### Testing\n\nFor using the manager in tests use\n`\\Rollerworks\\Component\\PdbSfBridge\\PdpMockProvider::getPdpManager()`.\n\n### Bundle Usage\n\nFirst add set a suitable cache adapter (_the Flex recipe uses `ArrayCache` to allow\nbooting-up the Kernel, but for production usage it's required to use a persistent\ncache adapter, as otherwise whenever the Manager is initialized the rules need to\nbe downloaded, parsed and cached)_.\n\n```yaml\n# config/packages/rollerworks_pdb.yaml\n\nrollerworks_pdb:\n    cache_pool: 'rollerworks.cache.public_prefix_db'\n\nframework:\n    cache:\n        pools:\n            # This name can be changed by setting `rollerworks_pdb.cache_pool` (**Don't reuse an existing cache pool!**)\n            rollerworks.cache.public_prefix_db:\n                adapter: cache.adapter.memcached # or cache.adapter.pdo\n                default_lifetime: 604800 # one week, the cache should be automatically refreshed\n```\n\n#### Offline usage\n\nWhen the HttpClient component is installed _and_ enabled the `HttpUpdatedPdpManager`\nis automatically used. When the HttpClient is not available the `StaticPdpManager`\nis used instead.\n\n_To force usage of the static adapter set configuration `rollerworks_pdb.manager` to `static`._\n\nWhen the static adapter is enabled you must run `rollerworks-pdb:update` with\nthe lists provided as files names.\n\n**And disable expiration of the cache, as otherwise the pre-bundled version\nwill be used instead.**\n\nFirst download the lists from https://publicsuffix.org/list/public_suffix_list.dat\nand https://data.iana.org/TLD/tlds-alpha-by-domain.txt respectively.\n\nAnd load them into the cache.\n\n```console\n$ bin/console rollerworks-pdb:update public_suffix_list.dat tlds-alpha-by-domain.txt\n```\n\nThe files path can be either absolute or relative to the current working directory.\n\n**Cache expiration disable:** Symfony cache-warming is designed as such that\nonce the cache is warmed-up no future file writing is expected (for security reasons).\n\nWhich is why the cache should be easily updatable, with preferable no filesystem writing.\n\nThe `rollerworks-pdb:update` updates the cache without writing the provided files\nto the application var/cache directory. So when the cache does expire, there would\nbe no files to read from, to prevent this the pre-bundled lists (used for the `MockManager`)\nare used instead, but these are only updated from time to time, and thus outdated.\n\n## Versioning\n\nFor transparency and insight into the release cycle, and for striving to\nmaintain backward compatibility, this package is maintained under the\nSemantic Versioning guidelines as much as possible.\n\nReleases will be numbered with the following format:\n\n`\u003cmajor\u003e.\u003cminor\u003e.\u003cpatch\u003e`\n\nAnd constructed with the following guidelines:\n\n* Breaking backward compatibility bumps the major (and resets the minor and patch)\n* New additions without breaking backward compatibility bumps the minor (and resets the patch)\n* Bug fixes and misc changes bumps the patch\n\nFor more information on SemVer, please visit \u003chttp://semver.org/\u003e.\n\n## License\n\nThis library is released under the [MIT license](LICENSE).\n\n## Contributing\n\nThis is an open source project. If you'd like to contribute,\nplease read the [Contributing Guidelines][contributing]. If you're submitting\na pull request, please follow the guidelines in the [Submitting a Patch][patches] section.\n\n[pdb]: https://github.com/jeremykendall/php-domain-parser\n[composer]: https://getcomposer.org/doc/00-intro.md\n[flex]: https://symfony.com/doc/current/setup/flex.html\n[contributing]: https://contributing.rollerscapes.net/\n[patches]: https://contributing.rollerscapes.net/latest/patches.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollerworks%2Fpdbsfbridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frollerworks%2Fpdbsfbridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollerworks%2Fpdbsfbridge/lists"}