Official PHP client to interact with apps made with MySocialApp
MySocialApp’s powerful API lets you quickly and seamlessly implement social networking features within your websites, mobile and back-end applications. Our API powers billions of requests for hundred of apps every month, delivering responses in under 100ms.
Add social features to your existing app, automate actions, scrape contents, analyze the users content, add bot to your app, almost anything that a modern social network can bring.. There is no limit! Any suggestion to add here? Do a PR.
Feature | Server side API | Swift client API |
---|---|---|
Profile management | ✔️ | ✔️ |
Feed | ✔️ | Partially |
Comment | ✔️ | Soon |
Like | ✔️ | Soon |
Notification | ✔️ | Partially |
Private messaging | ✔️ | Soon |
Photo | ✔️ | Soon |
User | ✔️ | ✔️ |
Friend | ✔️ | ✔️ |
URL rewrite | ✔️ | ✔️ |
URL preview | ✔️ | ✔️ |
User mention | ✔️ | ✔️ |
Hash tag | ✔️ | ✔️ |
Search users | ✔️ | Soon |
Search news feed | ✔️ | Soon |
Search groups | ✔️ | Soon |
Search events | ✔️ | Soon |
Group [optional module] | ✔️ | Soon |
Event [optional module] | ✔️ | Soon |
Roadbook [optional module] | ✔️ | Soon |
Live tracking with RideShare (exemple here) [optional module] |
✔️ | Soon |
Point of interest [optional module] | ✔️ | Soon |
Admin operations | ✔️ | Soon |
Looking for official TypeScript / JavaScript client API ? Click here Looking for official Java/Kotlin client API ? Click here Looking for official Swift client API ? Click here
Coming soon:
- Real time downstream handlers with FCM (Android), APNS (iOS) and Web Socket.
You must have "APP ID" to target the right App. Want to create your app?
Sign in to go.mysocialapp.io and go to API section. Your APP ID is part of the endpoint URL provided to your app. Which is something like https://u123456789123a123456-api.mysocialapp.io
. Your APP ID is u123456789123a123456
Ask for an administrator to give you the APP ID.
To use the SDK, you must use any of the currently available autoload (cf. autoload).
Here is an example of this SDK usage. Much more examples are coming very soon.
<?php
// Example of autoload script
spl_autoload_register(function ($class) {
$c = explode("\\", $class);
if (count($c) == 0 || strlen($c[0]) > 0) {
while (count($c) > 0) {
if (file_exists(__DIR__ . "/" . implode("/", $c) . ".php")) {
require_once __DIR__ . "/" . implode("/", $c) . ".php";
break;
}
if (count($c) == 1 && file_exists($c[0] . ".php")) {
require_once $c[0] . ".php";
break;
}
array_pop($c);
}
}
});
// First, create the main instance to access the API
$msa = (new \MySocialApp\MySocialAppBuilder())
// Set the app id matching your application. Here is the test application
->setAppId("u470584465854a728453")
// If you want to debug the API calls, add the following part
// ->setClientConfiguration(new \MySocialApp\Services\ClientConfiguration(10000,10000, array(), true))
->build();
// Create a new user account
$session = $msa->createAccount("myusername", "[email protected]", "mypassword", "my first name");
// If the account is already created, replace the line above with this one below
// $session = $msa->connectByEmail("[email protected]", "mypassword");
if ($session instanceof \MySocialApp\Models\Error) {
// Something went wrong, let's display the error
echo $session;
} else {
// Set the user external id to match another system's id
$myAccount = $session->getAccount()->get();
$myAccount->setExternalId("My external id, can be any string");
$myAccount->save();
// Add another user as a friend
$anotherUser = $session->getUser()->getByExternalId("Another external id");
$anotherUser->requestAsFriend();
// Post a new message on the wall
$myAccount->sendWallPost(
(new \MySocialApp\Models\FeedPostBuilder())
->setMessage("My new message on the wall")
->setVisibility(\MySocialApp\Models\AccessControl::_PUBLIC)
->build()
);
// Once everything is done, disconnect
$session->disconnect();
}
All contributions are welcomed. Thank you