{"id":20454776,"url":"https://github.com/cpiber/phpinclude","last_synced_at":"2026-05-06T19:37:30.077Z","repository":{"id":119473484,"uuid":"276676555","full_name":"cpiber/PHPInclude","owner":"cpiber","description":"Small tool to package php files","archived":false,"fork":false,"pushed_at":"2023-05-30T12:38:57.000Z","size":246,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T23:24:50.807Z","etag":null,"topics":["bundler","js","php","ts"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/cpiber.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-02T15:04:59.000Z","updated_at":"2022-02-15T08:53:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"49b972aa-483b-42c9-becd-7c88bfee3c80","html_url":"https://github.com/cpiber/PHPInclude","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpiber%2FPHPInclude","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpiber%2FPHPInclude/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpiber%2FPHPInclude/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpiber%2FPHPInclude/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpiber","download_url":"https://codeload.github.com/cpiber/PHPInclude/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242005820,"owners_count":20056434,"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":["bundler","js","php","ts"],"created_at":"2024-11-15T11:17:03.738Z","updated_at":"2026-05-06T19:37:25.052Z","avatar_url":"https://github.com/cpiber.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPInclude\n\nA tool for packaging php files into one.\n\nResolves includes and packages files into one big file. Useful for single-file installs.\n\n\n## Usage\n\n- Build file: `phpinclude [options] [\u003cinput file\u003e] [\u003coutput file\u003e]`\n- Watch file: `phpinclude --watch [options] [\u003cinput file\u003e] [\u003coutput file\u003e]`\n\nFor more information see `phpinclude --help`.\n\nNote: if you installed locally, you will probably have to prefix commands in the terminal with `npx`, i.e. `npx phpinclude ...`.\n\n### Example\n\n- Build `src/index.php` to `dest/index.php`: `phpinclude`\n- Build `src/main.php` to `dest/index.php`: `phpinclude src/main.php`\n- Build `src/main.php` to `dest/main.php`: `phpinclude src/main.php dest/main.php`\n- Build `src/main.php` to `dest/main.php` and watch: `phpinclude -w src/main.php dest/main.php`\n\n## Loaders\n\nThis project understands a handful of files.\n\nFor example in a php file, all `require`/`include` calls are resolved and recursively added to the build file.\n\nAvailable loaders:\n- `php` (parses PHP ast and resolves includes and globals)\n- `plaintext` (loads file contents and returns as string)\n- `base64` (loads file contents and returns as base64-encoded string)\n\nThese are mapped by default to the following file extensions:\n| extension | name        |\n|-----------|-------------|\n| `.php`    | `php`       |\n| `.txt`    | `plaintext` |\n| `.js`     | `plaintext` |\n| `.bin`    | `base64`    |\n\nLoaders and mappings can be changed via [configuration files](#configuration-files).\n\nIt is possible to write new loaders (see [PHPIncludeRollup](packages/PHPIncludeRollup/README.md)), though most of the time it is encouraged to have a separate build process for external files, and only include the final result via PHPInclude.\n\n## Configuration files\n\nThis application can be configured with the use of configuration files. Configuration files must be valid javascript. They may either export a configuration object, or a function that returns a configuration object.\n\nThe following object is expected:\n\n```ts\n{\n  loaders?: BuildFileSubclass[],\n  extensions?: Record\u003cstring, string\u003e,\n}\n```\n\nA loader must extend the abstract class [`BuildFile`](src/filetypes/file.ts). Later loaders have priority, i.e. user-defined loaders may override built-in loaders by specifying the same name.\n\nThe extensions object should map a file extension (e.g. `.php`) to the name of a loader. The special value `null` may be used to remove existing loaders for the file extension.\n\n### Example\n\n```js\nmodule.exports = {\n  extensions: {\n    '.bin' : 'plaintext',\n  },\n};\n```\n\nor\n\n```js\nmodule.exports = args =\u003e ({\n  extensions: {\n    '.bin' : 'plaintext',\n  },\n});\n```\n\n## Limitations\n\nCurrently known limitations:\n- Global variables aren't tracked properly ([#1](https://github.com/cpiber/PHPInclude/issues/1))\n- Variable scopes aren't passed to included files ([#2](https://github.com/cpiber/PHPInclude/issues/2))\n- Namespaces aren't supported\n- Magic constants aren't updated to source file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpiber%2Fphpinclude","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpiber%2Fphpinclude","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpiber%2Fphpinclude/lists"}