{"id":16266139,"url":"https://github.com/w3bdesign/statens-vegvesen-php","last_synced_at":"2026-02-17T01:02:52.360Z","repository":{"id":159918344,"uuid":"629694650","full_name":"w3bdesign/Statens-Vegvesen-PHP","owner":"w3bdesign","description":"Fetches Statens Vegvesen API data with PHP and renders the data with Twig. Styling with Bootstrap 5.","archived":false,"fork":false,"pushed_at":"2023-06-16T08:30:05.000Z","size":80,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T15:35:38.411Z","etag":null,"topics":["composer","oop","php","twig"],"latest_commit_sha":null,"homepage":"","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/w3bdesign.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-04-18T20:54:08.000Z","updated_at":"2023-05-12T00:47:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"2101093e-3936-402d-a9c2-a3948dcf5a94","html_url":"https://github.com/w3bdesign/Statens-Vegvesen-PHP","commit_stats":{"total_commits":53,"total_committers":1,"mean_commits":53.0,"dds":0.0,"last_synced_commit":"3ad0a43eb869de5176ae81bba2d5421e88375a93"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/w3bdesign/Statens-Vegvesen-PHP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3bdesign%2FStatens-Vegvesen-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3bdesign%2FStatens-Vegvesen-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3bdesign%2FStatens-Vegvesen-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3bdesign%2FStatens-Vegvesen-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w3bdesign","download_url":"https://codeload.github.com/w3bdesign/Statens-Vegvesen-PHP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3bdesign%2FStatens-Vegvesen-PHP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29528249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T00:57:22.232Z","status":"ssl_error","status_checked_at":"2026-02-17T00:54:25.811Z","response_time":115,"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":["composer","oop","php","twig"],"created_at":"2024-10-10T17:21:59.688Z","updated_at":"2026-02-17T01:02:52.015Z","avatar_url":"https://github.com/w3bdesign.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Display vehicle information from Statens Vegvesen\n\n\u003cimg src=\"https://user-images.githubusercontent.com/45217974/164569251-ffd9b726-ccc5-4d87-b210-ec11e11c8c9d.png\" alt=\"Screenshot\" /\u003e\n\n## Description\n\nPHP port of https://github.com/w3bdesign/Statens-Vegvesen\n\nFetching vehicle information from the REST API on \u003chttps://autosys-kjoretoy-api.atlas.vegvesen.no/api-ui/index-enkeltoppslag.html\u003e and displaying it.\n\nIt requires an API key that has to be set inside `.env` (rename .env.example to .env) that you can get from \u003chttps://www.vegvesen.no/om+statens+vegvesen/om+organisasjonen/apne-data/api-for-tekniske-kjoretoyopplysninger\u003e\n\n## Features\n\n-   PHP with OOP\n-   Separation of HTML and PHP code\n-   Composer with class autoloader\n-   Error handling and type annotations\n-   Twig for rendering HTML\n-   Bootstrap 5\n-   Responsive design\n-   Input validation with HTML5\n-   PHPDoc comments\n\n## Instructions\n\nTo implement this inside your code, you'll need to do the following:\n\n1.  Run `composer install` \n\n1.  Import the autoloader with `require_once \"vendor/autoload.php\";` \n\n2.  Include the class in your project by adding the `use` statement at the top of your file:\n\n```php    \n\nuse Vehicle\\VehicleDataFetcher;\nuse Vehicle\\VehicleDataRender;\n\n```\n\n3. Create a new instance of the `VehicleDataFetcher` class:\n\n```php\n$hasError = false;\n\nif ($_SERVER[\"REQUEST_METHOD\"] === \"POST\") {\n try {\n \t$vehicleDataFetcher = new VehicleDataFetcher();\n    // This should be fetched from an input text value with $_POST\n \t$regNummer = \"AX58167;\n \t$vehicleData = $vehicleDataFetcher-\u003egetVehicleData($regNummer);\n } catch (Exception $e) {\n \t$hasError = true;\n }\n}\n```\n\n4.Render the data inside your code:\n\n```php\nif (isset($vehicleData)) {\n$vehicleDataRender = new VehicleDataRender($vehicleData);\necho $vehicleDataRender-\u003erender();\n}\n```\n\n5. Handle the returned data or error message:\n\n```php \t\nif ($hasError) {\necho \"\u003cdiv class='container mt-5 text-center'\u003e\n\u003cdiv class='alert alert-danger' role='alert'\u003e\n\" . $e-\u003egetMessage() . \"\n\u003c/div\u003e\n\u003c/div\u003e\";\nreturn;\n}\n \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3bdesign%2Fstatens-vegvesen-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw3bdesign%2Fstatens-vegvesen-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3bdesign%2Fstatens-vegvesen-php/lists"}