https://github.com/felipe1234-dev/jquery-like-php-dom
The PHP DOM Parser that most closely resembles jQuery.
https://github.com/felipe1234-dev/jquery-like-php-dom
easy-peasy easy-to-use manipulation parser parser-plugin php-dom php-dom-query php-framework php7 web-parser web-parsers webscraping
Last synced: 13 days ago
JSON representation
The PHP DOM Parser that most closely resembles jQuery.
- Host: GitHub
- URL: https://github.com/felipe1234-dev/jquery-like-php-dom
- Owner: felipe1234-dev
- License: mit
- Created: 2020-12-14T00:27:51.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-27T20:23:06.000Z (about 5 years ago)
- Last Synced: 2025-06-08T21:59:04.296Z (8 months ago)
- Topics: easy-peasy, easy-to-use, manipulation, parser, parser-plugin, php-dom, php-dom-query, php-framework, php7, web-parser, web-parsers, webscraping
- Language: PHP
- Homepage:
- Size: 188 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jQuery-like PHP DOM
> Easy-to-learn php dom parser with CSS selector, short codes and ability to manipulate text nodes
[](https://github.com/felipe1234-dev/jquery-like-php-dom/issues)
[](https://github.com/felipe1234-dev/jquery-like-php-dom/network)
[](https://github.com/felipe1234-dev/jquery-like-php-dom/stargazers)
[](https://github.com/felipe1234-dev/jquery-like-php-dom/blob/main/LICENSE)
Simple PHP Dom Query interface simplification over native PHP Dom Document, which tries to look like closely to jQuery to look friendly to front-end developers. In this library, most of the main functions in jQuery and jQuery-like PHP DOM look exactly like behavior and syntax. This library was done for training purposes.
## Installation
**Composer**
```
composer require felipe1234-dev/php-dom-query
```
**Git**
```
git clone git://git.code.sf.net/p/jquery-like-php-dom/repository jquery-like-php-dom
```
## jQuery-like PHP DOM vs jQuery comparison
Wrapping elements
jQuery
```html
$(document).ready(function(){
$("img").wrap("<figure></figure>");
});
```
jQuery-like PHP DOM
```php
loadHTMLFile($url);
$doc->Q("img")->wrap("");
$doc->output();
?>
```
Appending html
jQuery
```html
$(document).ready(function(){
$("ol").append("<li>Appended item</li>");
});
```
jQuery-like PHP DOM
```php
include "path/webparser.php";
$doc = new WebParser();
$doc->loadHTMLFile($url);
$doc->Q("ol")->append("
$doc->output();
```
Changing first <a> href
jQuery
```html
$(document).ready(function(){
$("a:first").href("folder/index.html");
});
```
jQuery-like PHP DOM
```php
include "path/webparser.php";
$doc = new WebParser();
$doc->loadHTMLFile($url);
$doc->Q("a:first")->href("folder/index.html");
$doc->output();
```
*For more examples and usage, please refer to the installation folder under [`manual`](manual/start.md).*
## Release History
* v1.0
* CHANGE: Initial release ready to be used
## Meta
Felipe Alves – felipejean2002@gmail.com
Distributed under the MIT license. See ``LICENSE`` for more information.
[https://github.com/felipe1234-dev/github-link](https://github.com/felipe1234-dev/)
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b feature/jquery-like-php-dom`)
3. Commit your changes (`git commit -am 'Add some description'`)
4. Push to the branch (`git push origin feature/jquery-like-php-dom`)
5. Create a new Pull Request