{"id":19675815,"url":"https://github.com/progerxp/squall","last_synced_at":"2026-05-15T09:10:58.307Z","repository":{"id":8507125,"uuid":"10117836","full_name":"ProgerXP/Squall","owner":"ProgerXP","description":"functional programming for PHP with a syntax that makes sense.","archived":false,"fork":false,"pushed_at":"2013-09-05T11:51:37.000Z","size":148,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-10T04:25:35.664Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ProgerXP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-17T06:58:57.000Z","updated_at":"2024-03-16T20:52:55.000Z","dependencies_parsed_at":"2022-09-12T20:14:56.608Z","dependency_job_id":null,"html_url":"https://github.com/ProgerXP/Squall","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProgerXP%2FSquall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProgerXP%2FSquall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProgerXP%2FSquall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProgerXP%2FSquall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProgerXP","download_url":"https://codeload.github.com/ProgerXP/Squall/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240985487,"owners_count":19889101,"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":[],"created_at":"2024-11-11T17:26:00.474Z","updated_at":"2026-05-15T09:10:58.265Z","avatar_url":"https://github.com/ProgerXP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Squall\n\nFunctional programming for PHP with a syntax that makes sense. Dependencies-free except for **mbstring**.\n\nFocuses on concise, clean and intuitive syntax. You don't have to learn \"promises\", \"object types\", \"carriers\" or any other high rocket science - just do it:\n```PHP\nS(array('foo' =\u003e 'bar', 123 =\u003e 987))-\u003ekeys()-\u003eup()-\u003eget();\n  //=\u003e array('FOO', '123')\n```\n\nThe only thing you will want to learn are Callbacks - because if you do it will make your code _much_ more concise:\n```PHP\nS(array('foo' =\u003e 'bar', 123 =\u003e 987), 'S.#up#')\n  //=\u003e array('FOO', '123')\n```\n\nSquall follows jQuery's **implicit iteration** approach meaning that most of its functions accept both scalar and array/object values returning scalars and arrays correspondingly: `echo S::up('scalar');`.\n\nSquall is used by [Sqobot](https://github.com/ProgerXP/Sqobot) and [VaneMart](https://github.com/ProgerXP/VaneMart).\n\nLicensed in public domain. Visit author's homepage at http://proger.me.\n\n## Usage\n\nYou only need `squall.php`. After it's `include`'d call `Squall\\initEx()` or `Squall\\init()` to create aliases for its functions (you don't have to if you will refer to them under its namespace - `Squall\\Functions`, etc.).\n\n```PHP\ninclude 'squall.php';\nSquall\\initEx();\necho S::capitalize('squall it');\n```\n\nYou can alias Squall to another namespace:\n```PHP\nSquall\\initEx('UnderThisNS');\necho UnderThisNS\\S::capitalize('squall it');\n```\n\n...and/or with another class name:\n```PHP\n// for global\nSquall\\initEx('', 'Sq');\n// for NS\\\nSquall\\initEx('NS', 'Sq');\n\necho NS\\Sq::capitalize('squall it');\n// Main function is aliased as well.\necho NS\\Sq(array('squall it'));\n```\n\n**S()** function is twofold:\n* with 1 parameter it creates a chained version of data passed to it (usually an array/object); you can call any Squall function (static methods `Squall\\Functions`) like `S($data)-\u003ekeys()` and then retrieve produced data with `-\u003eget()`\n* with 2 parameters it's an alias to `S::map()`\n\nThere is no difference between calling static `S::func()` and intance `S()-\u003efunc() except that you don't have to provide the data as the first argument`.\n\n## Callbacks\n\nSquall expands on regular PHP _callable_ format adding pipes, extra parameters, evaluations and more while retaining original compatibility (any _callable_ is valid Squall callback but vice versa might not be true).\n\nIn general you can not care about custom callbacks if you're happy with what they can provide. Otherwise you might learn how to twist calls and shorten your code with a little extra effort:\n```PHP\n$data = array(' fBzR  ' =\u003e 1, 'XrLf ' =\u003e 2);\nS::map($data, array('|#trim#|strtolower|str_rot13'));\n  //=\u003e array(' fBzR  ' =\u003e 'some', 'XrLf ' =\u003e 'keys')\n```\n\n_Help text is yet to be written, for now you can find a draft [here](http://uverse.i-forge.net/wiki/demo/?33s). Drop a line if you're interested._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogerxp%2Fsquall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprogerxp%2Fsquall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogerxp%2Fsquall/lists"}