2017 © Pedro Peláez
 

library throttle

Rate Limiter and Usage tracker

image

owlgrin/throttle

Rate Limiter and Usage tracker

  • Thursday, June 4, 2015
  • by owlgrin
  • Repository
  • 2 Watchers
  • 2 Stars
  • 364 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 8 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

throttle

Throttle allows you to maintain a integration between your plans and your features., (*1)

Installation

To install the package, include the following in your composer.json., (*2)

"owlgrin/throttle": "dev-master"

And then include the following service provider in your app.php., (*3)

'Owlgrin\Throttle\ThrottleServiceProvider'

And lastly, publish the config., (*4)

php artisan config:publish owlgrin/throttle

Usage

Write this command in your artisan to create migrations, (*5)

throttle:table

Now migrate all the tables to your mysql db, (*6)

php artisan migrate

Entry of New Plan, (*7)

Its time to create a new plan by using Owlgrin\Plan\PlanRepo 's add function, (*8)

plan's format is as follows, (*9)

$plan = {
  "plan":{
      "name" : "Simple",
      "identifier" :"simple",
      "description" :"this is a simple plan",
        "features": [
          {
            "name":"Horn",
            "identifier":"horn",
            "tier" :[
                {
                "rate":"4",
                "per_quantity":1,
                "limit":"500"
              },
               {
                "rate":"3",
                "per_quantity":1,
                "limit":"5000"
              }
            ]
     },
        {
            "name":"Mail",
            "identifier":"mail",
            "tier" :[
                {
                "rate":"4",
                "per_quantity":1,
                "limit":"100"
              },
               {
                "rate":"3",
                "per_quantity":1,
                "limit":"1000"
              }
            ]
     }
    ]
  }
}

Subscription of user, (*10)

You can subscribe a user with plan id by using, (*11)

Owlgrin\Throttle\Subscriber\SubscriberRepo

subscribe($userId, $planId), (*12)

Biller, (*13)

You can calculate the bill by just using, (*14)

Owlgrin\Throttle\Biller\Biller

calculate($userId), (*15)

or can estimate bill by, (*16)

estimate($plan), (*17)

$plan = {'plan_id':1,
          'feature':{
            {feature_id}:{usage},
            {feature_id}:{usage}
          }
        }

The Versions

04/06 2015

dev-master

9999999-dev

Rate Limiter and Usage tracker

  Sources   Download

MIT

The Requires

 

by Mohit Mamoria
by Sahil Sarpal
by Mayank Thapliyal

09/04 2015

v0.2.0

0.2.0.0

Rate Limiter and Usage tracker

  Sources   Download

MIT

The Requires

 

by Mohit Mamoria
by Sahil Sarpal
by Mayank Thapliyal

23/01 2015

v0.1.0

0.1.0.0

Rate Limiter and Usage tracker

  Sources   Download

MIT

The Requires

 

by Mohit Mamoria
by Sahil Sarpal
by Mayank Thapliyal