static-php-cli icon indicating copy to clipboard operation
static-php-cli copied to clipboard

Vendor mode in a custom project, with custom extensions

Open yoramdelangen opened this issue 9 months ago • 12 comments

What does this PR do?

Minor changes for allowing to use the library in a custom project instead of forking and adjusting code within the "project base".

Thread of the question can be found in and also fix #687.

Added the following options to adjust:

  • Adding a custom command
  • Allow for custom changes for BuilderProvider after initializing.
  • By adding the following tree/namespace you can add custom extensions project-based without forking:
➜  poc-vendored-php-static-cli git:(main) tree --gitignore
.
├── bin
│   └── spc
├── composer.json
├── composer.lock
├── config
│   ├── ext.json
│   ├── lib.json
│   └── source.json
└── src
    ├── ConsoleApplication.php
    ├── MyCommand.php
    └── builder
        ├── extension
        │   └── snowflake.php
        ├── linux
        │   └── library
        │       └── snowflake.php
        ├── macos
        │   └── library
        │       └── snowflake.php
        └── unix
            └── library
                └── snowflake.php

Project example can be found here. In the example I have added pdo_snowflake extension, because I need it, and it gives a good example.

Compling works, only the testing part fails at the moment due to PHP not using the pdo_snowflake.so file.

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option. If a modification is not involved, please skip it directly.

  • [x] If you modified *.php, run composer cs-fix at local machine.
  • [x] If it's an extension or dependency update, make sure adding related extensions in src/global/test-extensions.php.
  • [x] If you changed the behavior of static-php-cli, update docs in ./docs/.
  • [x] If you updated config/xxx.json content, run bin/spc dev:sort-config xxx.

yoramdelangen avatar Apr 04 '25 10:04 yoramdelangen