Skip to content

feature: allow setting client config at runtime #14

Description

@talss89

Use case: I'm attempting to use this brilliant package to build a monitoring system for WP, and as such need to be able to set WORDPRESS_URL at runtime. In a single 'request', we may want to contact a number of different WordPress instances.

Adding methods to set the hostname etc. at runtime doesn't really fit well with the singleton / facade based approach IMO, but perhaps I've overlooked something?

Instead, I'm using something like:

 $client = new Client($the_wordpress_url);
 $wp = new WordPress($client);

It would be really nice if we could overload the BaseWordPress constructor to allow passing a string, which could be passed into the Client constructor - resulting in the tidier form of:

$wp = new WordPress($the_wordpress_url);

I believe that change wouldn't affect the singleton-style functionality at all.

I'm very aware this could be completely the wrong approach completely though.

Thanks for your time and effort - it's greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions