{"id":16731277,"url":"https://github.com/rohit-chouhan/theguardian-api-php","last_synced_at":"2025-03-15T18:19:23.225Z","repository":{"id":62550787,"uuid":"503713057","full_name":"rohit-chouhan/theguardian-api-php","owner":"rohit-chouhan","description":"PHP API Client for The Guardian News.","archived":false,"fork":false,"pushed_at":"2022-06-15T13:10:05.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T13:13:21.906Z","etag":null,"topics":["api","api-client","free","guardiannews","newsapi"],"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/rohit-chouhan.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}},"created_at":"2022-06-15T10:11:01.000Z","updated_at":"2023-08-30T09:10:09.000Z","dependencies_parsed_at":"2022-11-03T02:00:45.193Z","dependency_job_id":null,"html_url":"https://github.com/rohit-chouhan/theguardian-api-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Ftheguardian-api-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Ftheguardian-api-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Ftheguardian-api-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Ftheguardian-api-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohit-chouhan","download_url":"https://codeload.github.com/rohit-chouhan/theguardian-api-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243770169,"owners_count":20345255,"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","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":["api","api-client","free","guardiannews","newsapi"],"created_at":"2024-10-12T23:36:30.967Z","updated_at":"2025-03-15T18:19:23.204Z","avatar_url":"https://github.com/rohit-chouhan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg width=\"300\" src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/The_Guardian.svg/1280px-The_Guardian.svg.png\"/\u003e\n\u003cp\u003ePHP API Client for The Guardian News.\u003c/p\u003e\n\n**Requirements**\n* PHP 5.6.0 or greater\n\nThe documentation for the Guardian News API can found [here](http://open-platform.theguardian.com/documentation/), In order to connect you will need an api key, which you can be generate from [here](http://open-platform.theguardian.com/access/)\n\n### Usage\nTo use this client api, first download this gihutb files, and start using.\n```php\n\u003c?php\n    require_once 'vendor/autoload.php';\n    $theguardian = new TheGuardian('your_api_key');\n```\n**methods**\n\n| methods  | descriptions   |\n| ------------ | ------------ |\n|  $theguardian-\u003eget_articles() |  Content  |\n| $theguardian-\u003eget_article(`id`)  |  Single Item |\n| $theguardian-\u003eget_tags()  |  Tags |\n| $theguardian-\u003eget_sections()  | Sections |\n| $theguardian-\u003eget_editions()  | Editions |\n\n#### 📌 get_articles() `Content`\nA Content module can be utilized as an interface for the content endpoint provided by the Guardian.\n```php\n\u003c?php\n    require_once 'vendor/autoload.php';\n\n    $theguardian = new TheGuardian('test');\n    $articles = $theguardian\n                -\u003esearch(\"test\")\n                -\u003esection(\"technology\")\n                -\u003eshow_fields(\"all\")\n                -\u003eget_articles();\n    //you can add more functions to the object\n\n    foreach ($articles as $article) {\n        echo $article-\u003ewebTitle.\"\u003cbr\u003e\";\n    }\n?\u003e\n```\n#### 📌 get_article() `Single Item`\n```php\n\u003c?php\n    require_once 'vendor/autoload.php';\n\n    $theguardian = new TheGuardian('test');\n    $articles = $theguardian\n                -\u003eshow_fields(\"all\")\n                -\u003eget_article(\"business/2014/feb/18/uk-inflation-falls-below-bank-england-target\");\n?\u003e\n```\n#### 📌 get_tags() `Tags`\nTags are returned by the tags endpoint. We manually categorize all Guardian content based on these tags, which number more than 50,000.\n```php\n\u003c?php\n    require_once 'vendor/autoload.php';\n\n    $theguardian = new TheGuardian('test');\n    $articles = $theguardian\n                -\u003esearch(\"sport\")\n                -\u003eget_tags()\n?\u003e\n```\n#### 📌 get_sections() `Sections`\nUsing this section module, the Guardian's sections endpoint can be accessed. The guardian's data can be accessed through this link. For example, business, sports, and technology are examples of query parameters (q).\n```php\n\u003c?php\n    require_once 'vendor/autoload.php';\n\n    $theguardian = new TheGuardian('test');\n    $articles = $theguardian\n                -\u003esearch(\"sport\")\n                -\u003eget_sections()\n?\u003e\n```\n#### 📌 get_editions() `Editions`\nAll editions in the API are returned by the editions endpoint. An edition is a front main page on the Guardian site. There are currently editions of the Guardian available for the United Kingdom(uk), the United States(us) and Australia(au).\n```php\n\u003c?php\n    require_once 'vendor/autoload.php';\n\n    $theguardian = new TheGuardian('test');\n    $articles = $theguardian\n                -\u003esearch(\"sport\")\n                -\u003eget_editions()\n?\u003e\n```\n\n#### Developer\nThis API Client created by [Rohit Chouhan](https://rohitchouhan.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit-chouhan%2Ftheguardian-api-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohit-chouhan%2Ftheguardian-api-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit-chouhan%2Ftheguardian-api-php/lists"}