summaryrefslogtreecommitdiff
path: root/bin/wiki/vendor/addwiki/mediawiki-api-base/docs/overview.rst
blob: 0e83549d70b8ef4f49456b90490e220a686d51b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
========
Overview
========

addwiki/mediawiki-api-base is a PHP HTTP client wrapped around guzzle that makes it easy to interest with a mediawiki installation.

#. Uses PSR-3 interfaces for logging
#. Handles Mediawiki login, sessions, cookies and tokens
#. Handles response errors by throwing catchable UsageExceptions
#. Retries failed requests where possible
#. Allows Async requests

Requirements
========================

#. PHP 5.5.0
#. Guzzle HTTP library ~6.0

.. _installation:

Installation
========================

The recommended way to install this library is with
`Composer <http://getcomposer.org>`_. Composer is a dependency management tool
for PHP that allows you to declare the dependencies your project needs and
installs them into your project.

.. code-block:: bash

    # Install Composer
    curl -sS https://getcomposer.org/installer | php

You can add addwiki/mediawiki-api-base as a dependency using the composer.phar CLI:

.. code-block:: bash

    php composer.phar require addwiki/mediawiki-api-base:~2.0

Alternatively, you can specify addwiki/mediawiki-api-base as a dependency in your project's
existing composer.json file:

.. code-block:: js

    {
      "require": {
         "addwiki/mediawiki-api-base": "~2.0"
      }
   }

After installing, you need to require Composer's autoloader:

.. code-block:: php

    require 'vendor/autoload.php';

You can find out more on how to install Composer, configure autoloading, and
other best-practices for defining dependencies at `getcomposer.org <http://getcomposer.org>`_.


Bleeding edge
--------------------------

During your development, you can keep up with the latest changes on the master
branch by setting the version requirement for addwiki/mediawiki-api-base to ``~2.0@dev``.

.. code-block:: js

   {
      "require": {
         "addwiki/mediawiki-api-base": "~2.0@dev"
      }
   }


License
===================

Licensed using the `GPL-2.0+ <https://opensource.org/licenses/GPL-2.0>`_.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


Contributing
========================

Running the tests
-----------------

In order to contribute, you'll need to checkout the source from GitHub and
install the dependencies using Composer:

.. code-block:: bash

    git clone https://github.com/addwiki/mediawiki-api-base.git
    cd mediawiki-api-base
    curl -s http://getcomposer.org/installer | php
    ./composer.phar install --dev

The library is tested with a combination of linters and phpunit. Run all of the tests as follows:

.. code-block:: bash

    ./composer.phar test

You can choose to run each part of the whole test suite individually using the following commands:

.. code-block:: bash

    # Run the linting only
    ./composer.phar lint
    # Run phpunit only
    ./composer.phar phpunit
    # Run only the phpunit unit tests
    ./composer.phar phpunit-unit
    # Run only the phpunit integration tests
    ./composer.phar phpunit-integration