Skip to content

Instantly share code, notes, and snippets.

View MediumPoster.php
<?php
class MediumPoster
{
private CurlService $service;
private string $workingdir;
public function __construct($intToken, $workingdir = "")
{
$this->intToken = $intToken;
View CurlService.php
<?php
class CurlService
{
private string $baseUrl;
private array $headers = [];
public function __construct(string $baseUrl)
{
$this->baseUrl = $baseUrl;
$this->setHeader("Content-Type", "application/json");
View cli-template.php
#!/usr/local/bin/php
<?php
function usage(?string $msg = null): string
{
$argv = $GLOBALS['argv'];
$usage = "\n";
$usage .= sprintf("usage: %s <what>\n", $argv[0]);
$usage .= sprintf("%6s %-6s %s\n", "-h", "", "this help message");
$usage .= sprintf("%6s %-6s %s\n", "-a", "<more>", "add a little more");