Code Monkey home page Code Monkey logo

throttle's Introduction

throttle

Throttle allows you to maintain a integration between your plans and your features.

Installation

To install the package, include the following in your composer.json.

"sahil/throttle": "dev-master"

And then include the following service provider in your app.php.

'Owlgrin\Throttle\ThrottleServiceProvider'

And lastly, publish the config.

php artisan config:publish sahil/throttle

Usage

Write this command in your artisan to create migrations

throttle:table

Now migrate all the tables to your mysql db

php artisan migrate

Entry of New Plan

Its time to create a new plan by using Owlgrin\Plan\PlanRepo 's add function

plan's format is as follows

$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

You can subscribe a user with plan id by using

Owlgrin\Throttle\Subscriber\SubscriberRepo

subscribe($userId, $planId)

Biller

You can calculate the bill by just using

Owlgrin\Throttle\Biller\Biller

calculate($userId)

or can estimate bill by

estimate($plan)

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

throttle's People

Contributors

sahilsarpal15 avatar mohitmamoria avatar mayank009 avatar

Watchers

James Cloos avatar  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.