Skip to content

Commit 7c222d6

Browse files
committed
Getting ready for release.
1 parent cfab9cd commit 7c222d6

File tree

5 files changed

+50
-28
lines changed

5 files changed

+50
-28
lines changed

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
RouterOS API client implementation.
2-
This package allows you to read and write information from a RouterOS host using MikroTik's RouterOS API.
2+
RouterOS is the flag product of the company MikroTik and is a powerful router software. One of its many abilities is to allow control over it via an API. This package provides a client for that API, in turn allowing you to use PHP to control RouterOS hosts.

docs/tutorials/PEAR2_Net_RouterOS/PEAR2_Net_RouterOS.pkg

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<para>
1818
RouterOS is the flag product of the company {@link http://mikrotik.com/ MikroTik}
1919
and is a powerful router software. One of its many abilities is to allow control over it via an API.
20-
This package provides a client for that API, in turn allowing you to use PHP to control RouterOS hosts.
20+
This package provides a client for {@link http://wiki.mikrotik.com/wiki/Manual:API that API}, in turn allowing you to use PHP to control RouterOS hosts.
2121
</para>
2222
</refsect1>
2323
<refsect1 id="{@id requirements}">
@@ -26,39 +26,42 @@ This package provides a client for that API, in turn allowing you to use PHP to
2626
<listitem>PHP 5.3.0 or later.</listitem>
2727
<listitem>A host with RouterOS v3 or later.</listitem>
2828
<listitem>Enabled API service on the RouterOS host.</listitem>
29+
<listitem>The PCRE extension (bundled and enabled by default in PHP).</listitem>
30+
<listitem>The iconv extension (optional; bundled and enabled by default in PHP; required only if you want to use automatic charset convertion)</listitem>
31+
<listitem>PEAR2_Net_Transmitter (bundled with the PEAR2_Net_RouterOS archive; installed automatically by Pyrus)</listitem>
2932
</itemizedlist>
3033
<para>
31-
There are no dependencies from extensions that are not bundled with PHP.
32-
The only dependency is the PCRE (Pearl Compatible Regular Expressions) extension, which is bundled and enabled by default in PHP.
33-
</para>
34-
<para>
3534
The API service is disabled by default. To enable it, you need to execute
36-
<programlisting role="cmd">/ip service set numbers="api" address="0.0.0.0/0" disabled="no"</programlisting>
35+
<programlisting role="sh">/ip service set numbers="api" address="0.0.0.0/0" disabled="no"</programlisting>
3736
at a RouterOS terminal. The "address" argument in the command above allows you to limit access to this service only to certain IP addresses. For security's sake, it's better that you limit connections only to the IP address with which PHP will access RouterOS.
3837
</para>
3938
</refsect1>
4039
<refsect1 id="{@id install}">
4140
<title>Installation</title>
41+
<refsect2 id="{@id pyrus-install}">
42+
<title>Installation with {@link http://pear2.php.net Pyrus/PEAR2}</title>
43+
44+
<para>Assuming you have {@link http://pear.php.net/manual/en/installationpyrus.introduction.php installed Pyrus}, you can install PEAR2_Net_RouterOS from the PEAR2 channel with</para>
45+
<programlisting role="sh">pyrus install PEAR2_Net_RouterOS-alpha</programlisting>
46+
47+
<para>You might notice that the version number of PEAR2_Net_RouterOS suggests it's a beta, and yet we use "-alpha" in the command above. Well, yes, PEAR2_Net_RouterOS is a beta, but it has a dependency to another package - PEAR2_Net_Transmitter - which is an alpha. To avoid getting errors, you need to use "-alpha" until that package reaches a beta.</para>
48+
49+
<para>If you've decided to not use the PEAR2 channel, but instead install directly from the archive distributed at the project page, you can use</para>
50+
<programlisting role="sh">pyrus install /path/to/downloaded/archive.tgz</programlisting>
51+
<para>If you haven't installed PEAR_Net_Transmitter previously, Pyrus will install the one at the PEAR2 channel (not the bundled version, although the two are equivalent at the time of this writing).</para>
52+
</refsect2>
4253
<refsect2 id="{@id pear-install}">
43-
<title>Installation with the PEAR installer.</title>
44-
<para>
45-
If you don't already have the pear installer, see the
46-
{@link http://pear.php.net/manual/en/installation.php installation instructions in the PEAR manual}. The version of the PEAR installer that is bundled with PHP 5.3.0 should be sufficient.
47-
</para>
48-
<para>
49-
To use the PEAR installer, you must have the TGZ version of the file.
50-
Installation is as easy as opening up a command prompt, going to the pear installer's folder and typing
51-
<programlisting role="cmd">pear install "%tgz%"</programlisting>
52-
Replacing <emphasis>%tgz%</emphasis> with the location of the archive.
53-
</para>
54+
<title>Installation with PEAR.</title>
55+
<para>Like most PEAR2 packages, PEAR2_Net_RouterOS is compatible with the PEAR installer. However, you have to first discover the PEAR2 channel with</para>
56+
<programlisting role="sh">pear channel-discover pear2.php.net</programlisting>
57+
<para>and only then install PEAR2_Net_RouterOS with</para>
58+
<programlisting role="sh">pear install pear2/PEAR2_Net_RouterOS-alpha</programlisting>
5459
</refsect2>
5560
<refsect2 id="{@id manual-install}">
5661
<title>Manual installation.</title>
57-
<para>
58-
Instead of using the PEAR installer, you can also just extract the files into any directory in your include_path.
59-
To emulate the PEAR installer, you can simply extract the contents of the folder "src" in that folder.
60-
Note that the examples in the rest of the documentation assume installation with the PEAR installer.
61-
</para>
62+
<para>The archive includes a version of PEAR2_Net_Transmitter, so if you've downloaded the archive, instead of using the PEAR(2) installer, you can just extract the contents of the "src" folder wherever you like. To emulate the PEAR(2) installer, you can place the files in a folder that's within your include_path.</para>
63+
64+
<para>If you're installing from the respository, you'll have to also install PEAR2_Net_Transmitter in one way or another before you can use this package.</para>
6265
</refsect2>
6366
</refsect1>
6467
<refsect1 id="{@id usage}">

docs/tutorials/PEAR2_Net_RouterOS/Query.cls

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,15 @@ The {@link Query} class uses a "fluent" interface, i.e. it always returns the qu
6666
</para>
6767
<programlisting role="php">$query = Query::where('address', '192.168.0.100', Query::ACTION_GREATHER_THAN)->orWhere('address', '192.168.0.100');</programlisting>
6868
</refsect1>
69+
<refsect1 id="{@id limiting-returned-properties}">
70+
<title>Limiting returned properties</title>
71+
72+
<para>The query works a little like the "WHERE" clause in an SQL statement - it limits the amount of responses returned (which can be thought of as a "record" in DB terms) - but it doesn't limit the arguments of each response (which can be thought of as "fields" in DB terms, and are often reffered to as "properties" in the RouterOS documentation).</para>
73+
74+
<para>To do that, you need to set an API specific argument called ".proplist". The value is a comma separated list of arguments to be listed in the responses. For example, if you were only interested in the MAC addresses, you can do:</para>
75+
76+
<programlisting role="php">$request->setArgument('.proplist', 'mac-address');</programlisting>
77+
<para>or if you wanted MAC addresses and comments</para>
78+
<programlisting role="php">$request->setArgument('.proplist', 'mac-address,comment');</programlisting>
79+
</refsect1>
6980
</refentry>

extrasetup.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
$transmitterPackage
44
= new \PEAR2\Pyrus\Package(
55
__DIR__ . DIRECTORY_SEPARATOR
6-
. '../../PEAR2_Net_Transmitter.git/package.xml'
6+
. '../PEAR2_Net_Transmitter.git/package.xml'
77
);
88
unset($transmitterPackage->files['docs/docblox.xml']);
99
unset($transmitterPackage->files['docs/doxygen.ini']);
10-
unset($transmitterPackage->files['tests/configuration.xml']);
10+
11+
unset($transmitterPackage->files['tests/ClientTest.php']);
12+
unset($transmitterPackage->files['tests/ServerTest.php']);
13+
unset($transmitterPackage->files['tests/UnconnectedTest.php']);
1114
unset($transmitterPackage->files['tests/bootstrap.php']);
15+
unset($transmitterPackage->files['tests/phpunit.xml']);
16+
unset($transmitterPackage->files['tests/secondaryPeer.xml']);
17+
unset($transmitterPackage->files['tests/secondaryPeer.bat']);
18+
1219
$extrafiles = array($transmitterPackage);

package.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<file name="bootstrap.php" role="test">
130130
<tasks:replace type="pear-config" from="../src" to="php_dir" />
131131
</file>
132-
<file name="configuration.xml" role="test" />
132+
<file name="phpunit.xml" role="test" />
133133
</dir>
134134
<dir name="examples">
135135
<file name="callback-and-loop.php" role="doc" />
@@ -164,6 +164,7 @@
164164
<package>
165165
<name>PEAR2_Net_Transmitter</name>
166166
<channel>pear2.php.net</channel>
167+
<min>1.0.0a2</min>
167168
</package>
168169
<extension>
169170
<name>PCRE</name>
@@ -259,8 +260,8 @@
259260
as="PseudoServer.php"
260261
/>
261262
<install
262-
name="tests/configuration.xml"
263-
as="configuration.xml"
263+
name="tests/phpunit.xml"
264+
as="phpunit.xml"
264265
/>
265266
<install
266267
name="tests/bootstrap.php"

0 commit comments

Comments
 (0)