Download the PHP package amsify42/php-domfinder without Composer

On this page you can find all versions of the php package amsify42/php-domfinder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-domfinder

PHP DOM Finder

PHP package for searching document object model efficiently and with more readable way.

Installation

Table of Contents

  1. Loading Source
  2. Important Notes
  3. Meta Tags
  4. Elements
  5. Element Class
  6. Element Id
  7. Element Attribute
  8. Regex Extraction
  9. Element Methods
  10. Multi Level Finder

1. Loading Source


File

HTML

XML

URL

For HTML

For XML

Using helper method

Note: Make sure you pass true as 3rd parameter to constructor/helper method or 2nd parameter to load method for loading content from URL.

2. Important Notes


1. DOMDocument

Amsify42\DOMFinder\DOMFinder class uses Amsify42\DOMFinder\DOM\Document which extends PHP pre defined class DOMDocument. You can use all the methods of DOMDocument using this instance

Example:

2. DomXPath

Amsify42\DOMFinder\DOMFinder class uses PHP pre defined class DomXPath for querying document. If you want to use all the methods of DomXPath, you can use this instance

Example:

3. DOMElement

All the element results you get after querying document will be of type Amsify42\DOMFinder\DOM\Element which extends PHP pre defined class DOMElement.

You can use all the methods of DOMElement from all the element items. Example:

Most importantly, whenever you try to get the first or particular key element by index, it will either return NULL or element of type Amsify42\DOMFinder\DOM\Element. Examples:

3. Meta Tags


After source has been loaded, you can use these meta tags related methods.

To get specific meta tag value

By default it takes content attribute value from meta element, to get value from other attribute, pass 3rd parameter

4. Elements


To get specific elements from DOM

To get first element

To get the element by index position

5. Element Class


Equals

Find all elements by class name

Find first element by class

Find all div tag element by class

Find first div tag element by class

For getting element by its key position

Like

Find all elements contains class

Find first element contains class

Find all div tag element contains class

Find first div tag element contains class

For getting element by its key position

6. Element Id


Equals

Find all elements by id

Find first element by id

Find all div tag element by id

Find first div tag element by id

Like

Find all elements contains id

Find first element contains id

Find all div tag element contains id

Find first div tag element contains id

For getting element by its key position

7. Element Attribute


Equals

Find all elements by attribute

Find first element by attribute

Find all div tag element by attribute

Find first div tag element by attribute

For getting element by its key position

Like

Find all elements contains attribute

Find first element contains attribute

Find all div tag element contains attribute

Find first div tag element contains attribute

For getting element by its key position

8. Regex Extraction


To extract particular item from html, consider this sample html

For extracting multiple instances of data by regex, pass 2nd parameter as true

You can also pass multiple regex as array for multi level check and extraction

9. Element methods


These are the methods you can use at element level

For getting outer and inner HTML of element, you can use these methods

Outer html will print

Inner html will print

10. Multi Level Finder


This section is to demonstrate how the dom finder works at multi level.

Simple

The above query is same as DomXPath

You will get all the ul elements

Element Level

This approach actually creates DOMFinder instance at each element level when you try to do query.


All versions of php-domfinder with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
amsify42/php-curl-http Version dev-master
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package amsify42/php-domfinder contains the following files

Loading the files please wait ....