{"id":26917478,"url":"https://github.com/matronator/pristine-php","last_synced_at":"2025-09-17T23:10:40.285Z","repository":{"id":285475701,"uuid":"958267344","full_name":"matronator/pristine-php","owner":"matronator","description":"Various code snippets and useful functions in PHP","archived":false,"fork":false,"pushed_at":"2025-03-31T23:33:12.000Z","size":160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-16T06:11:39.375Z","etag":null,"topics":["code-snippets","php","php-snippets","snippets","snippets-collection","supreme-snippets","useful-functions","useful-scripts"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matronator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["matronator"],"patreon":"matronator","open_collective":null,"ko_fi":"matronator","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.paypal.me/matronator","https://www.blockchain.com/btc/address/35VRpVQaqFWjUCnVRpGineShz76QyYgSVg"]}},"created_at":"2025-03-31T23:20:51.000Z","updated_at":"2025-03-31T23:33:15.000Z","dependencies_parsed_at":"2025-04-01T00:37:13.901Z","dependency_job_id":null,"html_url":"https://github.com/matronator/pristine-php","commit_stats":null,"previous_names":["matronator/pristine-php"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matronator/pristine-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fpristine-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fpristine-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fpristine-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fpristine-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matronator","download_url":"https://codeload.github.com/matronator/pristine-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fpristine-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275680444,"owners_count":25508570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-17T02:00:09.119Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-snippets","php","php-snippets","snippets","snippets-collection","supreme-snippets","useful-functions","useful-scripts"],"created_at":"2025-04-01T20:36:58.668Z","updated_at":"2025-09-17T23:10:40.262Z","avatar_url":"https://github.com/matronator.png","language":"PHP","readme":"# Pristine PHP\n\n![Pristine PHP logo](logo.jpg)\n\nCollection of useful PHP functions and code snippets.\n\n\u003c!-- TOC --\u003e\n\n- [Pristine PHP](#pristine-php)\n    - [Advanced string Interpolation](#advanced-string-interpolation)\n    - [Casting](#casting)\n    - [Folder exists](#folder-exists)\n    - [JSON to class](#json-to-class)\n    - [One time file download](#one-time-file-download)\n\n\u003c!-- /TOC --\u003e\n\n## Advanced string Interpolation\n\n\u003e Source: https://stackoverflow.com/a/15410466/13604898\n\n```php\nfunction identity(mixed $arg): mixed {\n    return $arg;\n}\n$interpolate = \"identity\";\n\necho \"\u003cinput value='{$interpolate(1 + 1 * random_int())}' /\u003e\";\n```\n\n## Casting\n\nSee [Casting.php](Casting.php)\n\n## Folder exists\n\n```php\n/**\n * Checks if a folder exist and return canonicalized absolute pathname (sort version)\n * @param string $folder the path being checked.\n * @return mixed returns the canonicalized absolute pathname on success otherwise FALSE is returned\n */\nfunction folder_exist(string $folder): string|false\n{\n    // Get canonicalized absolute pathname\n    $path = realpath($folder);\n\n    // If it exist, check if it's a directory\n    return ($path !== false AND is_dir($path)) ? $path : false;\n}\n```\n\n## JSON to class\n\nSee [JSON2Class.php](JSON2Class.php)\n\n## One time file download\n\nSee [OnetimeFileDownload.php](OnetimeFileDownload.php)\n","funding_links":["https://github.com/sponsors/matronator","https://patreon.com/matronator","https://ko-fi.com/matronator","https://www.paypal.me/matronator","https://www.blockchain.com/btc/address/35VRpVQaqFWjUCnVRpGineShz76QyYgSVg"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatronator%2Fpristine-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatronator%2Fpristine-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatronator%2Fpristine-php/lists"}