{"id":15029396,"url":"https://github.com/simplepie/utility-pack","last_synced_at":"2025-04-11T16:36:50.106Z","repository":{"id":57051278,"uuid":"92632736","full_name":"simplepie/utility-pack","owner":"simplepie","description":"A set of small utilities for PHP.","archived":false,"fork":false,"pushed_at":"2019-12-03T22:45:36.000Z","size":319,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T16:36:12.523Z","etag":null,"topics":["enum","parser","php","php72","php73","php74","querystring","simplepie","time","types","url","util"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplepie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-28T01:09:45.000Z","updated_at":"2024-06-14T23:50:47.000Z","dependencies_parsed_at":"2022-08-24T03:40:46.643Z","dependency_job_id":null,"html_url":"https://github.com/simplepie/utility-pack","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplepie%2Futility-pack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplepie%2Futility-pack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplepie%2Futility-pack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplepie%2Futility-pack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplepie","download_url":"https://codeload.github.com/simplepie/utility-pack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248441464,"owners_count":21103997,"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","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":["enum","parser","php","php72","php73","php74","querystring","simplepie","time","types","url","util"],"created_at":"2024-09-24T20:10:31.327Z","updated_at":"2025-04-11T16:36:50.068Z","avatar_url":"https://github.com/simplepie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/simplepie/.github/master/logo.png\" width=\"500\"\u003e\u003cbr\u003e\u003c/div\u003e\n\n----\n\n# Utility Pack\n\nA set of small utilities for PHP 7.2+.\n\n## Badges\n\n### Health\n\n[![Open Issues](http://img.shields.io/github/issues/simplepie/utility-pack.svg?style=for-the-badge)](https://github.com/simplepie/utility-pack/issues)\n[![Pull Requests](https://img.shields.io/github/issues-pr/simplepie/utility-pack.svg?style=for-the-badge)](https://github.com/simplepie/utility-pack/pulls)\n[![Contributors](https://img.shields.io/github/contributors/simplepie/utility-pack.svg?style=for-the-badge)](https://github.com/simplepie/utility-pack/graphs/contributors)\n[![Repo Size](https://img.shields.io/github/repo-size/simplepie/utility-pack.svg?style=for-the-badge)](https://github.com/simplepie/utility-pack/pulse/monthly)\n[![GitHub Commit Activity](https://img.shields.io/github/commit-activity/y/simplepie/utility-pack.svg?style=for-the-badge)](https://github.com/simplepie/utility-pack/commits/master)\n[![GitHub Last Commit](https://img.shields.io/github/last-commit/simplepie/utility-pack.svg?style=for-the-badge)](https://github.com/simplepie/utility-pack/commits)\n\n### Quality\n\n[![Travis branch](https://img.shields.io/travis/simplepie/utility-pack/master.svg?style=for-the-badge\u0026label=Travis%20CI)](https://travis-ci.org/simplepie/utility-pack)\n[![Coveralls](https://img.shields.io/coveralls/github/simplepie/utility-pack/master.svg?style=for-the-badge)](https://coveralls.io/github/simplepie/utility-pack)\n[![Code Quality](http://img.shields.io/scrutinizer/g/simplepie/utility-pack.svg?style=for-the-badge\u0026label=Scrutinizer)](https://scrutinizer-ci.com/g/simplepie/utility-pack)\n[![Symfony Insight](https://img.shields.io/sensiolabs/i/ea218481-dce7-434a-8a3c-bd9cd9818cca.svg?style=for-the-badge\u0026label=Symfony%20Insight)](https://insight.symfony.com/projects/ea218481-dce7-434a-8a3c-bd9cd9818cca)\n\n### Social\n\n[![Author](http://img.shields.io/badge/author-@skyzyx-blue.svg?style=for-the-badge)](https://twitter.com/skyzyx)\n[![Follow](https://img.shields.io/twitter/follow/simplepie_ng.svg?style=for-the-badge\u0026label=Follow%20@simplepie_ng)](https://twitter.com/intent/follow?screen_name=simplepie_ng)\n[![Blog](https://img.shields.io/badge/medium-simplepie--ng-blue.svg?style=for-the-badge)](https://medium.com/simplepie-ng)\n[![Stars](https://img.shields.io/github/stars/simplepie/utility-pack.svg?style=for-the-badge\u0026label=GitHub%20Stars)](https://github.com/simplepie/utility-pack/stargazers)\n\n### Compliance\n\n[![License](https://img.shields.io/github/license/simplepie/utility-pack.svg?style=for-the-badge)](https://github.com/simplepie/utility-pack/blob/master/LICENSE.md)\n\n## Usage\n\n### QueryString\n\nBelieve it or not, different PHP installations can have different default values for generating query strings. This class uses explicit rules so that query strings are always generated exactly the same way. Leverages [`http_build_query()`](http://php.net/manual/en/function.http-build-query.php) under the hood.\n\n```php\n\u003c?php\nuse SimplePie\\UtilityPack\\Util\\QueryString;\n\necho QueryString::build([\n    'limit'  =\u003e 'a',\n    'order'  =\u003e 'b',\n    'offset' =\u003e 'c',\n]);\n\n#=\u003e limit=a\u0026order=b\u0026offset=c\n```\n\n### Time\n\nSimple constants for time. Makes time calculations easier to read and understand.\n\n```php\n\u003c?php\nuse SimplePie\\UtilityPack\\Util\\Time;\n\necho sprintf('%s, %s, %s', 1 * Time::SECOND, 2 * Time::SECONDS, 10 * Time::SECONDS);\n#=\u003e 1, 2, 10\n\necho sprintf('%s, %s, %s', 1 * Time::MINUTE, 2 * Time::MINUTES, 10 * Time::MINUTES);\n#=\u003e 60, 120, 600\n\necho sprintf('%s, %s, %s', 1 * Time::HOUR, 2 * Time::HOURS, 10 * Time::HOURS);\n#=\u003e 3600, 7200, 36000\n\necho sprintf('%s, %s, %s', 1 * Time::DAY, 2 * Time::DAYS, 10 * Time::DAYS);\n#=\u003e 86400, 172800, 864000\n\necho sprintf('%s, %s, %s', 1 * Time::WEEK, 2 * Time::WEEKS, 10 * Time::WEEKS);\n#=\u003e 604800, 1209600, 6048000\n\necho 0.5 * Time::YEAR;\n#=\u003e 15778800\n```\n\nYou can also use the standard ISO-8601 format, with _second_ granularity, and set to UTC _“Zulu”_ time (using the _Z_ annotation).\n\n```php\n\u003c?php\nuse SimplePie\\UtilityPack\\Util\\Time;\n\necho gmdate(Time::FORMAT_ISO8601_ZULU);\n#=\u003e 2017-05-28T01:46:06Z\n```\n\n### Type\n\nYou can easily get the scalar type or classname of any object.\n\n```php\n\u003c?php\nuse SimplePie\\UtilityPack\\Util\\Types;\n\necho Types::getClassOrType(\n    new \\SimpleXMLElement('\u003cxml/\u003e')\n);\n#=\u003e SimpleXMLElement\n\necho Types::getClassOrType(\n    new DateTime(\n        'now',\n        new DateTimeZone('UTC')\n    )\n);\n#=\u003e DateTime\n\necho Types::getClassOrType('string'));\n#=\u003e string\n\necho Types::getClassOrType(111));\n#=\u003e integer\n\necho Types::getClassOrType(111.0));\n#=\u003e double\n\necho Types::getClassOrType(true));\n#=\u003e boolean\n\necho Types::getClassOrType(false));\n#=\u003e boolean\n```\n\n## Coding Standards\n\nPSR-1/2/5/12/19 are a solid foundation, but are not an entire coding style by themselves. We automate a large part of our style requirements using [PHP CS Fixer](http://cs.sensiolabs.org) and [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer). (The things that we cannot yet automate are documented in the [SimplePie NG Coding Standards](https://github.com/simplepie/simplepie-ng-coding-standards).)\n\nThese can be applied/fixed automatically by running the (lightweight) linter:\n\n```bash\nmake lint\n```\n\nAdditionally, in our quest to write excellent code, we use a variety of tools to help us catch issues with what we've written, including:\n\n| Type | Description |\n| ---- | ----------- |\n| Linting Tools | [PHP CS Fixer](http://cs.sensiolabs.org), [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) |\n| QA Tools | [PDepend](https://github.com/pdepend/pdepend), [PHPLOC](https://github.com/sebastianbergmann/phploc), [PHP Copy/Paste Detector](https://github.com/sebastianbergmann/phpcpd), [PHP Code Analyzer](https://github.com/wapmorgan/PhpCodeAnalyzer) |\n| Static Analysis | [Phan](https://github.com/phan/phan), [PHPStan](https://github.com/phpstan/phpstan), [Psalm](https://github.com/vimeo/psalm), [PHP Dependency Analysis](https://github.com/mamuz/PhpDependencyAnalysis) |\n\nThese reports can be generated by running the (heavyweight) analyzer:\n\n```bash\nmake analyze\n```\n\n## Please Support or Sponsor Development\n\nThe SimplePie project is a labor of love. Development of the next-generation of SimplePie was started in June 2017 as because it's a project I love, and I believe our community would benefit from this tool.\n\nIf you use SimplePie — especially to make money — it would be swell if you could kick down a few bucks. As the project grows, and we start leveraging more services and architecture, it would be great if it didn't all need to come out of my pocket.\n\nYou can also sponsor the development of a particular feature. If there's a feature that you want to see implemented, and I believe it's the right fit for the SimplePie project, you can sponsor the development of the feature to get it prioritized.\n\nYour contributions are greatly and sincerely appreciated. See the **Sponsor** button along the top of the page for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplepie%2Futility-pack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplepie%2Futility-pack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplepie%2Futility-pack/lists"}