Add a Piwigo Namespace #1463

Open
opened 2026-10-05 00:44:54 +02:00 by adam · 1 comment
Owner

Namespaces have been included in PHP since version 5.3, they are vital to preventing conflicts that may arise from having two codebases interacting. Currently I am attempting to write an integration between Piwigo and phpBB, but unfortunately several functions share the same name. It is my understanding that this can be solved by adding the following code to the various source files:

<?php
namespace Piwigo;

This will make all functions and classes accessible from within Piwigo and if using from a different codebase, the functions can be accessed by appending \Piwigo to any function or class declaration. It also allows Piwigo to integrate other pre-written libraries without conflicts in the code.

Namespaces have been included in PHP since version 5.3, they are vital to preventing conflicts that may arise from having two codebases interacting. Currently I am attempting to write an integration between Piwigo and phpBB, but unfortunately several functions share the same name. It is my understanding that this can be solved by adding the following code to the various source files: ```php <?php namespace Piwigo; ``` This will make all functions and classes accessible from within Piwigo and if using from a different codebase, the functions can be accessed by appending _\Piwigo_ to any function or class declaration. It also allows Piwigo to integrate other pre-written libraries without conflicts in the code. <!-- github-sync-id:1272966179 -->
Author
Owner

I agree we could add namespaces.

You can also use Piwigo API in webservice. Wouldn't that work in your case?

I agree we could add namespaces. You can also use Piwigo API in webservice. Wouldn't that work in your case? <!-- github-comment-id:1256193979 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1463