Skip to content

Instantly share code, notes, and snippets.

@d8ahazard
d8ahazard / index.php
Last active Dec 26, 2018
PlexProfileScraper
View index.php
<?php
$files = glob("./profiles/*.xml");
$profiles = [];
$types = [];
$names = [];
foreach($files as $file) {
$data = new SimpleXMLElement(file_get_contents($file));
$flat = json_decode(json_encode($data), true);
$name = $flat['@attributes']['name'];
$dpTypes = [];
@d8ahazard
d8ahazard / swagger2Php.php
Last active Oct 11, 2018
Auto-generate PHP class from swagger documentation...
View swagger2Php.php
<?php
// You need to have guzzleHttp installed, and require the vendor path here...
header('content-type:text/plain');
$url = $_GET['url'];
$swaggerApi = json_decode(file_get_contents("$url"), true);
$outFile = pathinfo($url)['filename'] . ".php";
$paths = $swaggerApi['paths'];
$defs = $swaggerApi['definitions'];
You can’t perform that action at this time.