{"id":20678878,"url":"https://github.com/phpgt/cssxpath","last_synced_at":"2025-04-04T16:15:08.201Z","repository":{"id":29244357,"uuid":"117023753","full_name":"phpgt/CssXPath","owner":"phpgt","description":"Translate CSS selectors to XPath queries.","archived":false,"fork":false,"pushed_at":"2025-02-04T13:58:03.000Z","size":276,"stargazers_count":21,"open_issues_count":6,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T15:08:25.811Z","etag":null,"topics":["css","css-selector","css-selector-parser","dom","phpgt","translate-css-selectors","xpath","xpath-queries"],"latest_commit_sha":null,"homepage":"https://www.php.gt/cssxpath","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/phpgt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["phpgt"]}},"created_at":"2018-01-10T23:27:47.000Z","updated_at":"2025-02-12T02:44:20.000Z","dependencies_parsed_at":"2024-01-05T00:31:11.992Z","dependency_job_id":"d3baf64c-6060-4da0-a8b5-faeed417e4f9","html_url":"https://github.com/phpgt/CssXPath","commit_stats":{"total_commits":129,"total_committers":9,"mean_commits":"14.333333333333334","dds":0.4263565891472868,"last_synced_commit":"d99d35f7194bac19fb3f8726b70c1bc83de3e931"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCssXPath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCssXPath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCssXPath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCssXPath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpgt","download_url":"https://codeload.github.com/phpgt/CssXPath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208151,"owners_count":20901570,"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":["css","css-selector","css-selector-parser","dom","phpgt","translate-css-selectors","xpath","xpath-queries"],"created_at":"2024-11-16T21:22:53.637Z","updated_at":"2025-04-04T16:15:08.182Z","avatar_url":"https://github.com/phpgt.png","language":"PHP","funding_links":["https://github.com/sponsors/phpgt"],"categories":[],"sub_categories":[],"readme":"Translate CSS selectors to XPath queries.\n=========================================\n\nA lightweight and dependency free CSS to XPath translator. This repository is used to bring modern DOM functionality like [`querySelectorAll()`][qsa] to PHP in the [PHP.Gt/Dom][gt-dom] project.\n\n***\n\n\u003ca href=\"https://github.com/PhpGt/CssXPath/actions\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cssxpath-build.svg\" alt=\"Build status\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codacy.com/gh/PhpGt/CssXPath\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cssxpath-quality.svg\" alt=\"Code quality\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codecov.io/gh/PhpGt/CssXPath\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cssxpath-coverage.svg\" alt=\"Code coverage\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/PhpGt/CssXPath\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cssxpath-version.svg\" alt=\"Current version\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"http://www.php.gt/cssxpath\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cssxpath-docs.svg\" alt=\"PHP.Gt/CssXPath documentation\" /\u003e\n\u003c/a\u003e\n\nExample usage\n-------------\n\n\n```php\nuse Gt\\CssXPath\\Translator;\n\n$html = \u003c\u003c\u003cHTML\n\u003cform\u003e\n\t\u003clabel\u003e\n\t\tName\n\t\t\u003cinput name=\"name\" /\u003e\n\t\u003c/label\u003e\n\t\u003clabel\u003e\n\t\tCode:\n\t\t\u003cinput name=\"code\" /\u003e\n\t\u003c/label\u003e\n\t\u003cbutton name=\"do\" value=\"submit\"\u003eSubmit code\u003c/button\u003e\n\u003c/form\u003e\nHTML;\n\n$document = new DOMDocument();\n$document-\u003eloadHTML($html);\n\n$xpath = new DOMXPath($document);\n$inputElementList = $xpath-\u003equery(new Translator(\"form\u003elabel\u003einput\");\n```\n\n## Using this library with XML Documents\n\nTo correctly work with XML documents, where the attributes are case-sensitive, pass `false` to the `htmlMode` property of the constructor.\n\n```php\n$translator = new Translator(\"[data-FOO='bar']\", htmlMode: false);\n```\n\nIt's perhaps worth noting that for XML-style matching to work, you must load the document content with DOMDocument-\u003eload/DOMDocument-\u003eloadXML instead of DOMDocument-\u003eloadHTMLFile/DOMDocument-\u003eloadHTML, as the HTML loading methods automatically convert the tags and attribute names to lowercase. This is handled automatically when using [PHP.Gt/Dom][gt-dom].\n\n[qsa]: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n[gt-dom]: https://www.php.gt/dom\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fcssxpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpgt%2Fcssxpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fcssxpath/lists"}