Skip to content

Commit d71cfee

Browse files
authored
Merge pull request #2 from Simonsator/composer
Composer
2 parents 4caeed8 + 8780fca commit d71cfee

File tree

13 files changed

+352
-320
lines changed

13 files changed

+352
-320
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ Temporary Items
4646
.metadata/*
4747
.recommenders/*
4848
.idea/*
49+
50+
# Composer
51+
vendor/
52+
composer.lock

.phpstorm.meta.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// injections will have the following replacement rules.
66
sql_injection_subst(),
77
map([
8-
'{' => "fr_", // all `{` in injected SQL strings will be replaced with a prefix
9-
'}' => '', // all `}` will be replaced with an empty string
8+
'{$this->getTablePrefix()}' => 'fr_',
109
]));
1110
}

PAFLib/PAFPlayer.php

Lines changed: 0 additions & 91 deletions
This file was deleted.

PAFLib/PAFPlayerManager.php

Lines changed: 0 additions & 76 deletions
This file was deleted.

PAFLib/config.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

PAFLib/test/index.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

PAFLib/test/norequestsend.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

PAFLib/test/playerdatashow.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

PAFLib/test/playerdoesnotexist.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
11
# PHP API for Party and Friends
2-
A library for Party and Friends ([the free version for BungeeCord](https://www.spigotmc.org/resources/party-and-friends-for-bungeecord.9531/), [the extended version for Bungeecord](https://www.spigotmc.org/resources/party-and-friends-extended-for-spigot-supports-1-7-1-16-5.11633/) and [the extended version for Spigot](https://www.spigotmc.org/resources/party-and-friends-extended-for-spigot-supports-1-7-1-16-5.11633/)) to use its data in PHP scripts.
2+
3+
A PHP composer library for Party And
4+
Friends ([Free for Bungeecord](https://www.spigotmc.org/resources/party-and-friends-for-bungeecord-supports-1-7-x-to-1-19-x.9531/)
5+
, [Extended For Bungeecord/Velocity](https://www.spigotmc.org/resources/party-and-friends-extended-edition-for-bungeecord-velocity-supports-1-7-1-19.10123/)
6+
, [Extended For Spigot](https://www.spigotmc.org/resources/party-and-friends-extended-for-spigot-supports-1-7-1-19.11633/) (
7+
you need to use MySQL as a data source),
8+
or [Free For Velocity](https://forums.papermc.io/threads/party-and-friends-for-velocity-version-1-0-89.317/)), which
9+
allows developers to access Party And Friends data in PHP.
10+
311
## Requirements
4-
* PHP 7.4 or later
5-
* An installation of Party and Friends ([the free version for BungeeCord](https://www.spigotmc.org/resources/party-and-friends-for-bungeecord.9531/), [the extended version for Bungeecord](https://www.spigotmc.org/resources/party-and-friends-extended-for-spigot-supports-1-7-1-16-5.11633/) or [the extended version for Spigot](https://www.spigotmc.org/resources/party-and-friends-extended-for-spigot-supports-1-7-1-16-5.11633/)) with MySQL used as database
12+
13+
* PHP 7.4 or higher
14+
* [Composer](https://getcomposer.org/)
15+
* A MySQL server containing the Party And
16+
Friends ([Free for Bungeecord](https://www.spigotmc.org/resources/party-and-friends-for-bungeecord-supports-1-7-x-to-1-19-x.9531/)
17+
, [Extended For Bungeecord/Velocity](https://www.spigotmc.org/resources/party-and-friends-extended-edition-for-bungeecord-velocity-supports-1-7-1-19.10123/)
18+
, [Extended For Spigot](https://www.spigotmc.org/resources/party-and-friends-extended-for-spigot-supports-1-7-1-19.11633/) (
19+
you need to use MySQL as a data source),
20+
or [Free For Velocity](https://forums.papermc.io/threads/party-and-friends-for-velocity-version-1-0-89.317/)) data
21+
which should be accessed
622

723
## Installation
8-
* Put this library into your web directory folder
9-
* Enter your MySQL data into the "PAFLib/config.php" file
10-
* Test if everything works by opening the website %YOUR_HOST%/PAFLib/test/index.php
24+
25+
Add the following lines to your composer file:
26+
27+
```json
28+
{
29+
"repositories": [
30+
{
31+
"type": "vcs",
32+
"url": "https://github.com/Simonsator/PartyAndFriends-PHP-Lib"
33+
}
34+
],
35+
"require": {
36+
"simonsator/party-and-friends-php-lib": "@dev"
37+
}
38+
}
39+
```
40+
1141
## Where to start
12-
If you don't know how to use this library have a look at the ["test/index.php"](https://github.com/Simonsator/PartyAndFriends-PHP-Lib/blob/master/PAFLib/test/index.php) and ["test/playerdatashow.php"](https://github.com/Simonsator/PartyAndFriends-PHP-Lib/blob/master/PAFLib/test/playerdatashow.php)
42+
43+
A demo project can be found [here](https://github.com/Simonsator/PartyAndFriends-PHP-Lib-Demo). To get started, you
44+
should call the constructor of the class `Simonsator\PartyAndFriends\PAFPlayerManager`. You need to provide the table
45+
prefix used by Party And Friends and a PDO object with an active connection to the MySQL database which is used by Party
46+
And Friends. Using the methods of the `PAFPlayerManager` you can `PAFPlayer` objects, with which you can access data of
47+
players.

0 commit comments

Comments
 (0)