PHP Classes

PHP Web Monetization: Add a simple payment URL to monetize site pages

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 81 All time: 10,096 This week: 62Up
Version License PHP version Categories
php-monetization 1.0.0MIT/X Consortium ...7HTML, E-Commerce, AJAX, PHP 7
Description 

Author

This class can add a simple payment URL to monetize site pages.

It takes a payment pointer URL for a Web page and validates it to comply with the W3C Web monetization specification.

The class can generate HTML for a meta tag to include on a Web page and specify what payment system users of a site can use to pay for the producers of the page content.

Innovation Award
PHP Programming Innovation award nominee
August 2022
Number 4
Web monetization is a specification elaborated by the W3C organization to define how each site would like to monetize the site pages to reward the creators by letting know to the users of the page how to pay for the benefits that the page provides them.

This package provides a means to add HTML tags to a page to specify a payment system that the page users can use to pay the creators of a page according to Web monetization W3C standard specification.

Manuel Lemos
Picture of Chun-Sheng, Li
  Performance   Level  
Name: Chun-Sheng, Li <contact>
Classes: 37 packages by
Country: Taiwan Taiwan
Age: 31
All time rank: 21046 in Taiwan Taiwan
Week rank: 4 Up1 in Taiwan Taiwan Up
Innovation award
Innovation award
Nominee: 17x

Winner: 1x

Documentation

php-monetization

CI-Build

Introduction

  • This is a PHP for Web Monetization helper.

Features

Here are some features about Web Monetization:

  • Validate payment pointer URL.
  • Generate payment pointer URL with given arguments.
  • Generate payment pointer URL with meta tag.
  • Get default payment pointer URL.

Installation

We strongly recoomend using composer to install this package.

The installation steps are as follows:

composer require lee/php-monetization:^1.0

Usage

It's very simple. Here are some usages:

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Lee\WebMonetization\WebMonetization;

// Generate payment pointer URL with meta tag
$paymentPointerUrl = '$ilp.uphold.com/alice';
$metaTag = WebMonetization::generateMetaTag($paymentPointerUrl);

echo $metaTag; // <meta name="monetization" content="$ilp.uphold.com/alice">

// Validate payment pointer URL
$validateResult = WebMonetization::validatePaymentPointer($paymentPointerUrl);

echo $validateResult; // true

// Generate payment pointer
$interLedger = 'ilp';
$domainName = 'uphold';
$tldName = 'com';
$userTokenName = 'alice';
$paymentPointerUrl = WebMonetization::generatePaymentPointer($interLedger, $domainName, $tldName, $userTokenName);

echo $paymentPointerUrl; // $ilp.uphold.com/alice

// Get default payment pointer urls
$webMonetization = new WebMonetization();
$paymentPointerUrls = $webMonetization->getDefaultPaymentPointerUrls();

echo $paymentPointerUrls; // [ '$ilp.uphold.com/', '$ilp.gatehub.net/', '$pay.stronghold.co/',]

  Files folder image Files (9)  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (3 files)
Files folder imagetests (1 file)
Accessible without login Plain text file .cs.php Example Example script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files (9)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (9)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file ci.yml Data Auxiliary data

  Files folder image Files (9)  /  src  
File Role Description
  Plain text file InvalidPaymentPointerUrlException.php Class Class source
  Plain text file PaymentPointerPrefixes.php Class Class source
  Plain text file WebMonetization.php Class Class source

  Files folder image Files (9)  /  tests  
File Role Description
  Plain text file WebMonetizationTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:81
This week:0
All time:10,096
This week:62Up