{"id":49077315,"url":"https://github.com/maschmann/eprel-public-api-client","last_synced_at":"2026-04-20T10:33:40.926Z","repository":{"id":340189330,"uuid":"1164961988","full_name":"maschmann/eprel-public-api-client","owner":"maschmann","description":"PHP imeplementation of the EPREL public API spec","archived":false,"fork":false,"pushed_at":"2026-03-03T20:04:37.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-03T21:12:03.509Z","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/maschmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-23T17:15:32.000Z","updated_at":"2026-03-03T20:04:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maschmann/eprel-public-api-client","commit_stats":null,"previous_names":["maschmann/eprel-public-api-client"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/maschmann/eprel-public-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Feprel-public-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Feprel-public-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Feprel-public-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Feprel-public-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maschmann","download_url":"https://codeload.github.com/maschmann/eprel-public-api-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Feprel-public-api-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32043097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T10:33:29.490Z","status":"ssl_error","status_checked_at":"2026-04-20T10:32:30.107Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-04-20T10:33:40.287Z","updated_at":"2026-04-20T10:33:40.905Z","avatar_url":"https://github.com/maschmann.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EPREL API Client for PHP\n\n[![CI](https://github.com/maschmann/eprel-public-api-client/actions/workflows/ci.yml/badge.svg)](https://github.com/maschmann/eprel-public-api-client/actions/workflows/ci.yml)\n[![PHP Version](https://img.shields.io/badge/php-8.4+-8892BF.svg)](https://php.net/)\n\nA modern, fluent, and strongly-typed PHP client to interact with the **EPREL** (European Product Database for Energy Labelling) Public API.\n\n## What is EPREL?\nThe **Europäische Produktdatenbank für Energieverbrauchskennzeichnung** (European Product Database for Energy Labelling) is a database managed by the European Commission. It allows consumers to search for and verify the energy labels and product information sheets of appliances sold within the EU (e.g., refrigerators, washing machines, televisions, etc.).\n\nThis library allows you to seamlessly integrate the public search and retrieval capabilities of the EPREL database into your PHP applications.\n\n## Requirements\n- PHP 8.4 or higher\n- A PSR-18 compatible HTTP Client (e.g., Guzzle)\n- A PSR-17 compatible HTTP Factory\n- *(Optional but recommended)* A PSR-6 compatible Cache Implementation (defaults to an in-memory array cache)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require asm/eprel-api-client\n```\n\n## Usage\n\n### Basic Initialization\n\nYou can initialize the client using an array of parameters or through a fluent configuration interface.\n\n```php\nuse Asm\\EprelApiClient\\EprelClient;\n\n// Using the Fluent API (Recommended)\n$client = (new EprelClient())\n    -\u003euri('https://eprel.ec.europa.eu/api')\n    -\u003eapiKey('your-api-key') // If required by the API\n    -\u003eversion('1.6.3')\n    -\u003ecacheTtl(3600); // Cache responses for 1 hour\n\n// Alternatively, using the constructor:\n$client = new EprelClient([\n    'uri' =\u003e 'https://eprel.ec.europa.eu/api',\n    'cacheTtl' =\u003e 3600,\n]);\n```\n\n### Searching for Products\n\nYou can retrieve a paginated list of products matching specific filter criteria (like the product group or energy class).\n\n```php\n$page = $client-\u003egetProducts([\n    'productGroup' =\u003e 'REFRIGERATORS',\n    'energyClass' =\u003e 'A',\n    'size' =\u003e 20,\n    'page' =\u003e 0\n]);\n\necho \"Total Elements found: \" . $page-\u003etotalElements . \"\\n\";\n\nforeach ($page-\u003econtent as $productSummary) {\n    echo \"Brand: \" . $productSummary-\u003ebrandName . \"\\n\";\n    echo \"Model: \" . $productSummary-\u003emodelIdentifier . \"\\n\";\n    echo \"EPREL Reg Number: \" . $productSummary-\u003eregistrationNumber . \"\\n\";\n    echo \"Energy Class: \" . $productSummary-\u003eenergyClass . \"\\n\";\n    echo \"---\\n\";\n}\n```\n\n### Fetching Product Details\n\nTo retrieve the complete details, technical parameters, and URLs for the energy labels of a specific product, use its EPREL registration number.\n\n```php\nuse Asm\\EprelApiClient\\Exception\\ResourceNotFoundException;\n\ntry {\n    $productDetail = $client-\u003egetProduct('123456');\n    \n    echo \"Brand: \" . $productDetail-\u003ebrandName . \"\\n\";\n    echo \"Label URL: \" . $productDetail-\u003eenergyLabelUrl . \"\\n\";\n    echo \"Product Sheet URL: \" . $productDetail-\u003eproductInformationSheetUrl . \"\\n\";\n    \n    // Access arbitrary technical parameters provided by the API\n    if (isset($productDetail-\u003etechnicalParameters['volume'])) {\n        echo \"Volume: \" . $productDetail-\u003etechnicalParameters['volume'] . \" L\\n\";\n    }\n\n} catch (ResourceNotFoundException $e) {\n    echo \"Product not found in the EPREL database.\";\n} catch (\\Throwable $e) {\n    echo \"An API error occurred: \" . $e-\u003egetMessage();\n}\n```\n\n## Caching\n\nTo avoid hitting rate limits and to significantly improve your application's performance, it is highly recommended to inject a persistent PSR-6 Cache Item Pool.\n\nBy default, the client uses an in-memory `ArrayAdapter` which only persists data for the duration of the current PHP script execution.\n\n```php\nuse Symfony\\Component\\Cache\\Adapter\\RedisAdapter;\nuse Asm\\EprelApiClient\\EprelClient;\n\n$redisConnection = RedisAdapter::createConnection('redis://localhost');\n$cachePool = new RedisAdapter($redisConnection);\n\n$client = (new EprelClient())\n    -\u003esetCache($cachePool)\n    -\u003ecacheTtl(86400); // Cache for 24 hours\n```\n\n## Development \u0026 Testing\n\nThis library comes with a Dockerized environment for easy development and testing.\n\n```bash\n# Start the docker environment and install composer dependencies\nmake setup\n\n# Run PHPUnit tests\nmake test\n\n# Run code style checks (PHPCS)\nmake cs\n\n# Run static analysis (PHPStan Level max)\nmake stan\n\n# Run Psalm\nmake psalm\n\n# Run all tests and quality checks\nmake all\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaschmann%2Feprel-public-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaschmann%2Feprel-public-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaschmann%2Feprel-public-api-client/lists"}