Skip to content

Question: how can I use composers vendor/autoload.php from multiple projects using safe? #422

@mfn

Description

@mfn

Hi 👋🏼 ,

it might be related to #53 or #253

The problem:

  • I've two projects projectA/ and projectB/
  • completely separate projects, distinct namespacs, both using composer autoloading
  • both using thecodingmachine/safe:^2

I've a "glue" code which works a bit like:

require_once 'projectA/vendor/autoload.php';
require_once 'projectB/vendor/autoload.php';

// Do sommething with `ProjectA\Foo` and `ProjectB\Bar`

This used to work until both projects, which very well run and work on their own, got safe added and now it doesn't pass the second autoloader

PHP Fatal error: Cannot redeclare Safe\mysqli_get_client_stats() (previously declared in /projectA/vendor/thecodingmachine/safe/deprecated/mysqli.php:16) in /projectB/vendor/thecodingmachine/safe/generated/mysqli.php on line 34

Is there a way to get this working? I don't see anything like function_exists() in safe, so I guess not.

thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions