Download the PHP package wikitext/query without Composer

On this page you can find all versions of the php package wikitext/query. 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 query

Wikitext Query

Wikitext Query is a PHP query object that helps you to crawl through wikitext markup language.

Installation

Installation can be done using Composer to download and install Wikitext Query as well as its dependencies.

Usage

Before you can start to query anything you have to define the selectors that are available. You can create your own, although there is a set of matchers part of this package. All you need to do is add them:

Creating a new Query object can be done by passing it the wikitext content.

The Query object will split the wikitext into single lines; alternatively you can also pass it an array with lines yourself:

This initial Query (or main Query) serves as a something like the 'DOM'. Any action you perform on it, or any sub-query will always be related to this original object. This means that a sub-selection will still refer to the line numbers as present in the original wikitext.

The query object shows quite some similarity with jQuery when trying to query its content. Both the methods and the selectors are more or less the same. Each query action returns a new query in order to allow method chaining.

Please notice! Query actions like next and prev always relate back to the initial wikitext.

Documentation

Crawl

Find

Returns a Query object with all lines from the initial wikitext that match the selector.

When you use find on a Query object other than the main object it will filter from that.

Next

Returns a Query object with the line after the first item in the Query according to the initial wikitext. When the selector is specified it will return the line accordingly.

When none is found, an empty Query object is returned.

Prev

Returns a Query object with the line before the first item in the Query according to the initial wikitext. When the selector is specified it will return the line accordingly.

When none is found, an empty Query object is returned.

Next all

Returns a Query object with the lines after the first item in the Query according to the initial wikitext. When the selector is specified it will return the lines accordingly.

When none are found, an empty Query object is returned.

Prev all

Returns a Query object with the lines before the first item in the Query according to the initial wikitext. When the selector is specified it will return the lines accordingly.

When none are found, an empty Query object is returned.

Access

Items in the query object can be accessed in multiple ways.

Get text

Returns the lines of the Query object as a single string (imploded with "\n"").

Get items

Returns an array with all the lines in the Query object. The keys of the array will always correspond with their position in the initial wikitext.

Is empty

Returns true if the Query has no lines.

Count

Returns the number of lines in a Query.

First

Returns a Query object with the first of line of the Query.

Last

Returns a Query object with the last of line of the Query.

Eq

Returns a Query object with the nth line of the Query.

Match

Matches a regular expression against the wikitext and returns the defined index or the default value.

Countable, ArrayAccess & IteratorAggregate

A Query object can be treated as an array, but will always return its lines as Query objects.

Support

Please file issues here at Github


All versions of query with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
ext-json Version *
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 wikitext/query contains the following files

Loading the files please wait ....