laravel-house-ads

Packagist Packagist License Scrutinizer Code Quality Build Status

A simple house ads / cross-promo API for Laravel 5.*. This package is developed from the house ads solution in Sweaty Chair Studio, which serving interstitial house ad images to players. This contains API for getting the current house ads and a (coming soon) simple web console to create and edit the house ads. This package is aimed to be a plug-n-play solution, to serve your own house ads within your apps, cross-promo another apps, or even simply showing running events.

All current house ads are feed back to client, client can pick one to show, or showing them all one-by-one. This is depends on how you want and how you setup your client. In our case, we want only 1 house ad is shown on each time client app launch, if there are more than one to show, show the highest priority one. A clicked house ad (successfully redirected) will not shown again. All these can be setup in database so you can use it for client accordingly.

You can use it for showing static image or video, display as interstitial or in-app UI box, all depends on how you setup in the client and it’s out of the scope of this package, but the API setup should cover most of the cases for the clients. Institial popup showing static image on app launch, Sweaty Chair UI box showing video on menu, Voodoo

The web console is in the TODO list. Meanwhile, you will need to add the house ads into the database manually.

Step-by-step walk-through can be found here.

Table of Contents

Installation

Install this package via Composer:

$ composer require furic/house-ads

If you are using Laravel 5.5 or later, then installation is done. Otherwise follow the next steps.

Open config/app.php and follow steps below:

Find the providers array and add our service provider.

'providers' => [
    // ...
    Furic\HouseAds\HouseAdsServiceProvider::class
],

Configuration

To create table for redeem codes in database run:

$ php artisan migrate

Usage

House Ads Table

| Name            | Type      | Not Null |
|-----------------|-----------|----------|
| id              | integer   |     ✓    |
| game_id         | integer   |     ✓    |
| media_portrait  | varchar   |          |
| media_landscape | varchar   |          |
| open_url        | tinyint   |     ✓    |
| url_ios         | varchar   |          |
| url_android     | varchar   |          |
| repeat_count    | tinyint   |     ✓    |
| priority        | tinyint   |     ✓    |
| start_at        | date      |     ✓    |
| end_at          | date      |     ✓    |
| confirmed_count | mediumint |     ✓    |
| cancelled_count | mediumint |     ✓    |
| created_at      | datetime  |          |
| updated_at      | datetime  |          |

API URLs

GET <server url>/api/house-ads Returns a JSON array containing all valid house ads.

GET <server url>/api/house-ads/{id} Returns a JSON data continain the house ads with given ID, for debug purpose only.

PUT <server url>/api/house-ads/{id} Updates the shown, clicked or cancelled count of a house ad.

API Document can be found here.

Unity Client Repo

You can simply import this repo in Unity to communicate with your Laravel server with this package: <to be added>

TODO

License

laravel-house-ads is licensed under a MIT License.