{"id":23709925,"url":"https://github.com/nxtlvlsoftware/php-export","last_synced_at":"2025-07-23T06:03:51.091Z","repository":{"id":110553316,"uuid":"438133858","full_name":"NxtLvLSoftware/php-export","owner":"NxtLvLSoftware","description":"POC JS/Node style import/export for PHP.","archived":false,"fork":false,"pushed_at":"2021-12-14T05:59:52.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-30T06:21:24.770Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NxtLvLSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2021-12-14T05:52:04.000Z","updated_at":"2021-12-14T05:59:55.000Z","dependencies_parsed_at":"2023-04-07T20:30:58.247Z","dependency_job_id":null,"html_url":"https://github.com/NxtLvLSoftware/php-export","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NxtLvLSoftware/php-export","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtLvLSoftware%2Fphp-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtLvLSoftware%2Fphp-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtLvLSoftware%2Fphp-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtLvLSoftware%2Fphp-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NxtLvLSoftware","download_url":"https://codeload.github.com/NxtLvLSoftware/php-export/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtLvLSoftware%2Fphp-export/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266626115,"owners_count":23958344,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":[],"created_at":"2024-12-30T18:58:55.576Z","updated_at":"2025-07-23T06:03:51.083Z","avatar_url":"https://github.com/NxtLvLSoftware.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"JS style import/export for PHP\n===================\n__POC allowing developers to scope and rename imports according to context.__\n\n```php\nrequire_once 'vendor/autoload.php';\n\nuse function NxtLvLSoftware\\Import\\from;\n\n// imports\n[$named_func] = from('./functions');\n[$print_person, $person] = from('./classes');\n\n// call aliased function\n$named_func();\n\n// instantiate aliased class and call function from same import\n$print_person(new $person('Jimmy', 19));\n```\n\n## About\n\nEliminates the need for composer and other autoloaders in favour of a JS style import/export. If all code conforms and exports\nadhere to good practices then it gives control back to the application developer in terms of scoping code and naming required\nimports according to the current context.\n\nAll php files should define a unique namespace to avoid collisions when importing, which allows the import site to alias\nfunctions and classes to local variables using the [Symmetric array destructuring](https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.symmetric-array-destructuring) or [list()](https://www.php.net/manual/en/function.list.php) syntax.\n\nSee [classes.php](examples/classes.php) for declaring classes, [functions.php](examples/functions.php) for function definitions and [import.php](examples/import.php) for importing and using classes/functions.\n\n## Caveats\n\nUsually this approach only works nicely with simple single script applications, owing to fundamental differences between PHP and JS.\nWithout guarding all class and method declarations inside existing definition checks you'll run into duplicate definition\nexceptions quite easily.\n\n#### _## THIS IS POC SO NO UNIT TESTS ARE PROVIDED ##_\n\n## License Information\n\nThe content of this repo is \u0026 will always be licensed under the [Unlicense](http://unlicense.org/).\n\n\u003e This is free and unencumbered software released into the public domain.\n\u003e\n\u003e Anyone is free to copy, modify, publish, use, compile, sell, or\n\u003e distribute this software, either in source code form or as a compiled\n\u003e binary, for any purpose, commercial or non-commercial, and by any\n\u003e means.\n\n__A full copy of the license is available [here](../LICENSE).__\n\n#\n\n__A [NxtLvL Software Solutions](https://github.com/NxtLvLSoftware) product.__\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxtlvlsoftware%2Fphp-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnxtlvlsoftware%2Fphp-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxtlvlsoftware%2Fphp-export/lists"}