Download the PHP package moirei/saas-metre without Composer
On this page you can find all versions of the php package moirei/saas-metre. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package saas-metre
SaaS Metre
This package is a minimal and straight forward solution for tracking services usage on SaaS applications.
💚 Features
- Track
METERED
andVOLUME
measures (service offerings). E.g. tracking user monthly downloads and user allowed storage (for all time). - Simple period usage accumulator
- Tags to further description usage entries. Can also measure usage per tags.
- Eloquent compatible.
Installation
Concepts
Metre: A metre is container of measurements for your SaaS offering usage.
Period: Usage periods indicating your weekly, monthly, etc., SaaS subscription or billing cycle.
Measure: A measure fauture on the metre for your SaaS offering. E.g. "user_accounts"
, "auio_downloads"
.
Measure type: The types of measuremeants. Currently METERED
and VOLUME
. Usage of metreed measurements are calculated per period. E.g. if you provide your users 10 MP3 downloads per week. Volume measurements on the other hand are calculated for all time. E.g. you user may be allowed only a maximum of 2 collaborators at all times.
Measure limits [int
]: Used to limit usage of measures.
Measure tags: Tags make it possible to categorise and group usage on a single measure.
Usage
Create a metre
With array
Make from object value
Build progressively
Increment usage
Check usability
Use the canUse
method to determine whether a measure is usable. Returns bool
.
Get usage
Depending of the measure type (METERED
or VOLUME
), calculates usage for current period if metreed. Calculates usage for all time if volumed.
To get usage within a set time, provide a period.
Clear usage
Periods
Start a new period
Tags
Tags make it possible to categorise and group usage on a single measure. E.g. a product purchase, and ticket purchase may both be considered orders. However your users' subscription may be billed depending or the type of sale.
Now usage can be checked per measure tags:
With eloquent attributes
To use directly with Eloquent, use the provided Caster.
Now, perform user action according to usage status
Tests
All versions of saas-metre with dependencies
illuminate/support Version ^7|^8|^9
illuminate/contracts Version ^7|^8|^9
laravel/helpers Version ^1.5
spatie/data-transfer-object Version ^3.7
funeralzone/valueobjects Version ^0.5.0
nesbot/carbon Version ^2.58