{"id":21191724,"url":"https://github.com/indieweb/php-original-post-discovery","last_synced_at":"2025-06-30T14:03:55.914Z","repository":{"id":13391680,"uuid":"16079906","full_name":"indieweb/php-original-post-discovery","owner":"indieweb","description":"A set of PHP functions for determining the canonical URL for a post, given a POSSEd copy","archived":false,"fork":false,"pushed_at":"2016-03-14T16:15:12.000Z","size":43,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-10-29T19:01:05.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/indieweb.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":"2014-01-20T18:58:04.000Z","updated_at":"2017-03-11T10:33:25.000Z","dependencies_parsed_at":"2022-09-22T14:24:56.227Z","dependency_job_id":null,"html_url":"https://github.com/indieweb/php-original-post-discovery","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indieweb%2Fphp-original-post-discovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indieweb%2Fphp-original-post-discovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indieweb%2Fphp-original-post-discovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indieweb%2Fphp-original-post-discovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indieweb","download_url":"https://codeload.github.com/indieweb/php-original-post-discovery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243646664,"owners_count":20324586,"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":[],"created_at":"2024-11-20T19:04:41.201Z","updated_at":"2025-03-14T21:11:13.576Z","avatar_url":"https://github.com/indieweb.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-original-post-discovery\n\nA set of PHP functions for determining the canonical URL for a post, given a POSSEd copy. A partial implementation of the algorithm outlined at [original-post-discovery](http://indiewebcamp.com/original-post-discovery).\n\nA demo can be found [on waterpigs.co.uk/services/original-post](http://waterpigs.co.uk/services/original-post/).\n\n## Usage\n\nInstall using [Composer](https://getcomposer.org) `./composer.phar require indieweb/original-post-discovery:dev-master`.\n\n```php\n\u003c?php\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nlist($url, $err) = IndieWeb\\discoverOriginalPost('https://twitter.com/BarnabyWalters/status/423465842148671488');\nif ($err !== null) {\n\t// handle HTTP errors here\n}\n\n// do stuff (e.g. auto-fill in-reply-to form controls) with $url\n\n```\n\n### Other functions\n\n* `string $str = cleanString($str)` cleans up a bunch of weird encoding and character issues which can occur, specifically converting non-breaking space codepoints into normal spaces to handle some Twitter.com bugs\n* `string|null $url = originalPostUrlFromTwitter($html)` is a pure function for parsing HTML from Twitter.com and looking in it for trailing URLs\n* `string $str = stripHashtags($str)` removes hashtags from a string\n* `string|null $url = getTrailingUrl($str)` finds parenthesised (`text text. (http://example.com)`) or ellipsis (`text text… http://example.com`) trailing URLs in a string\n* `string|null $str = getUrlFromPermashortid($str)` looks for a trailing permashortid (`(cctld.me id)`) and converts it into a URL (assumes HTTP)\n\n## Testing\n\nA small PHPUnit test suite is provided — if making contributions please at least ensure that all the existing tests pass before/after your changes are made. If you could add new tests to cover the code you added that would be great too.\n\n## Version History\n\n### 0.1.0 2014-01-20\n* Initial extraction from Taproot, readme and basic test suite\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findieweb%2Fphp-original-post-discovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findieweb%2Fphp-original-post-discovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findieweb%2Fphp-original-post-discovery/lists"}