Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Rewrite to use parser or tokenizer instead of serializing #120

Description

@samdark

The idea is further development of #117.

Potentially we can avoid serializing by following these steps while merging configs:

  1. Tokenize/parse config. Replace all closures, $_ENV references and require with unique placeholders. Original code strings are kept in an array where key is this unique unique placeholder name.
  2. Read configs produced during step 1 with PHP. Merge them.
  3. Tokenize/parse config produced during step 2. Replace unique placeholders with strings saved during step 1.

Advantages

  • No need to serialize anything.
  • Will likely work well with PHP 8.
  • No need to depend on opis/closure (PHP 8 isn't ready, requires FFI for it) or riimu/kit-phpencoder (isn't active, extra layer).
  • End user will get native syntax for require and $_ENV.

Disadvantages

  • Likely not straightforward to implement.
  • Requires maintenance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions