Skip to main content
replaced http://stackapps.com/ with https://stackapps.com/
Source Link

I've already used the Stack.PHP libraryalready used the Stack.PHP library in a WordPress plugin and am deploying a second one. They had a class conflict and using class_exists before require_once/stackphp* didn't work.
I had to do this at the beginning of the file output_helper.php:

if( !class_exists( 'API' ) ):
require_once 'api.php';
require_once 'auth.php';
endif;
require_once 'combobox_output.php';
require_once 'table_output.php';

I ended also adding this to all files:

if( !class_exists( 'StackPHPClass' ) ):
class StackPHPClass {}
endif;

Thinking about it, the class names are quite simple (API, Auth, etc) and I'm afraid of conflicts with other plugins in the wild (I'm about to publish both on the official Repo). My OOP skill are limited, but would it be possible to add a Namespace or something like that without breaking backwards compatibility?

PS: Just a personal, unrelated, note; I miss the project being in GitHub instead of Launchpad.

I've already used the Stack.PHP library in a WordPress plugin and am deploying a second one. They had a class conflict and using class_exists before require_once/stackphp* didn't work.
I had to do this at the beginning of the file output_helper.php:

if( !class_exists( 'API' ) ):
require_once 'api.php';
require_once 'auth.php';
endif;
require_once 'combobox_output.php';
require_once 'table_output.php';

I ended also adding this to all files:

if( !class_exists( 'StackPHPClass' ) ):
class StackPHPClass {}
endif;

Thinking about it, the class names are quite simple (API, Auth, etc) and I'm afraid of conflicts with other plugins in the wild (I'm about to publish both on the official Repo). My OOP skill are limited, but would it be possible to add a Namespace or something like that without breaking backwards compatibility?

PS: Just a personal, unrelated, note; I miss the project being in GitHub instead of Launchpad.

I've already used the Stack.PHP library in a WordPress plugin and am deploying a second one. They had a class conflict and using class_exists before require_once/stackphp* didn't work.
I had to do this at the beginning of the file output_helper.php:

if( !class_exists( 'API' ) ):
require_once 'api.php';
require_once 'auth.php';
endif;
require_once 'combobox_output.php';
require_once 'table_output.php';

I ended also adding this to all files:

if( !class_exists( 'StackPHPClass' ) ):
class StackPHPClass {}
endif;

Thinking about it, the class names are quite simple (API, Auth, etc) and I'm afraid of conflicts with other plugins in the wild (I'm about to publish both on the official Repo). My OOP skill are limited, but would it be possible to add a Namespace or something like that without breaking backwards compatibility?

PS: Just a personal, unrelated, note; I miss the project being in GitHub instead of Launchpad.

Source Link
brasofilo
  • 1k
  • 8
  • 22

I've already used the Stack.PHP library in a WordPress plugin and am deploying a second one. They had a class conflict and using class_exists before require_once/stackphp* didn't work.
I had to do this at the beginning of the file output_helper.php:

if( !class_exists( 'API' ) ):
require_once 'api.php';
require_once 'auth.php';
endif;
require_once 'combobox_output.php';
require_once 'table_output.php';

I ended also adding this to all files:

if( !class_exists( 'StackPHPClass' ) ):
class StackPHPClass {}
endif;

Thinking about it, the class names are quite simple (API, Auth, etc) and I'm afraid of conflicts with other plugins in the wild (I'm about to publish both on the official Repo). My OOP skill are limited, but would it be possible to add a Namespace or something like that without breaking backwards compatibility?

PS: Just a personal, unrelated, note; I miss the project being in GitHub instead of Launchpad.