{"id":15361955,"url":"https://github.com/tj/php-selector","last_synced_at":"2025-04-06T12:13:03.190Z","repository":{"id":614772,"uuid":"253133","full_name":"tj/php-selector","owner":"tj","description":"PHP DOM parser / queries with CSS selectors","archived":false,"fork":false,"pushed_at":"2021-02-23T16:30:47.000Z","size":24,"stargazers_count":298,"open_issues_count":7,"forks_count":117,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-30T11:09:32.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"nuance/go-nlp","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tj.png","metadata":{"files":{"readme":"Readme.rdoc","changelog":"History.rdoc","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-07-17T00:03:57.000Z","updated_at":"2024-12-22T02:56:39.000Z","dependencies_parsed_at":"2022-07-07T14:59:52.742Z","dependency_job_id":null,"html_url":"https://github.com/tj/php-selector","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fphp-selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fphp-selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fphp-selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tj%2Fphp-selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tj","download_url":"https://codeload.github.com/tj/php-selector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478329,"owners_count":20945266,"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-10-01T12:57:35.784Z","updated_at":"2025-04-06T12:13:03.172Z","avatar_url":"https://github.com/tj.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n= PHP Selector\n\nQuick DOM query library I whipped up for an old\nPHP data miner I had which needed more flexibility.\n\nCurrent supports most CSS3 selectors.\n\nTested with php 5.2.8\n\n== Examples\n\nGiven the sample html:\n\n  $html = \u003c\u003c\u003cHTML\n    \u003cdiv id=\"article\" class=\"block large\"\u003e\n      \u003ch2\u003eArticle Name\u003c/h2\u003e\n      \u003cp\u003eContents of article\u003c/p\u003e\n      \u003cul\u003e\n        \u003cli\u003eOne\u003c/li\u003e\n        \u003cli\u003eTwo\u003c/li\u003e\n        \u003cli\u003eThree\u003c/li\u003e\n        \u003cli\u003eFour\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#\"\u003eFive\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/div\u003e\n  HTML;\n  \nThe following will return an array of elements:\n\n  select_elements('div#article.large', $html);\n  select_elements('div \u003e h2:contains(Article)', $html);\n  select_elements('div p + ul', $html);\n  select_elements('ul \u003e li:first-child', $html);\n  select_elements('ul \u003e li ~ li', $html);\n  select_elements('ul \u003e li:last-child', $html);\n  select_elements('li a[href=#]', $html);\n  \n== SelectorDOM\n\nPersistant object for element selection.\n\n  $dom = new SelectorDOM($html);\n  $links = $dom-\u003eselect('a');\n  $list_links = $dom-\u003eselect('ul li a');\n\n== Contribution\n\n* Like it? use it? feel free to extend and add more CSS3 support, and\n  run test.selector.php\n\n== More Information\n\n* View the source :P\n\n== License \n\n(The MIT License)\n\nCopyright (c) 2008 - 2009 TJ Holowaychuk \u003ctj@vision-media.ca\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj%2Fphp-selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftj%2Fphp-selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftj%2Fphp-selector/lists"}