Coder Social home page Coder Social logo

mysocialapp-php-client's Introduction

mysocialapp-php-client

MySocialApp - Seamless Social Networking features for your app

Official PHP client to interact with apps made with MySocialApp

What is 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.

What can you do?

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.

What features are available?

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.

Prerequisites

You must have "APP ID" to target the right App. Want to create your app?

App owner/administrator:

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

App user:

Ask for an administrator to give you the APP ID.

Usage

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();
}

Demo apps using MySocialApp

Contributions

All contributions are welcomed. Thank you

mysocialapp-php-client's People

Contributors

gobountz avatar evoxmusic avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar Pierre Mavro avatar  avatar Rémi Demol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.