Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class name conflicts #4

Open
ahutchings opened this issue Mar 1, 2011 · 9 comments
Open

Class name conflicts #4

ahutchings opened this issue Mar 1, 2011 · 9 comments
Assignees

Comments

@ahutchings
Copy link

When using the Tropo PHP library with other packages, it is likely that some class names will conflict. Two classes included with the library have common names, but are not used: Format and Date. Would it be possible for these to be namespaced (e.g. TropoFormat or real namespaces) or removed?

@mheadd
Copy link

mheadd commented Mar 2, 2011

Actually, those classes were meant to be used by developers that write WebAPI apps in PHP, to help format readback of text-to-speech content with SSML.

Your point is well taken, and I'm mulling over a couple of different ways to address it.

One option you always have is to fork this repo and remove them form your copy. You should be able to merge any future changes into your own fork should you want to stay current with future changes.

@mimecine
Copy link

I second the namespacing issues, many names are too common: Session, Result etc. Having everything namespaced Tropo would definitely make life easier if you ever need to combine the WebAPI with other frameworks... I guess one could use proper php namespacing, but that would bar people to use it with php older than 5.3.0 (and to be honest, php namespacing is pretty ugly and still a bit thorny I feel)

@mheadd
Copy link

mheadd commented Mar 29, 2011

Thanks for the comment. Still trying to decide on the best way to do this.

Looking for more developer input, also considering using a separate branch to support proper PHP namespacing to address this.

@kcivey
Copy link

kcivey commented Aug 12, 2011

A "Tropo" prefix on all the classes seems like it would work. I agree with mimecine that using PHP namespaces could be limiting (and is ugly, though I suppose we have to get used to it eventually).

@Daniel15
Copy link

Daniel15 commented Oct 9, 2011

Since the requirements already state "PHP 5.3.0 or greater", you can just use PHP namespaces. A simple approach is to stick everything into a "Tropo" namespace.

@Daniel15
Copy link

Daniel15 commented Oct 9, 2011

Oops, I didn't read through all the comments - Seems namespaces were already mentioned. They're the proper approach, and people should be on PHP 5.3 anyways. PHP 5.2 is deprecated.

@acoulton
Copy link

I agree, PHP namespaces are the best way to handle this (and pretty much required if you want to use this library with many of the common frameworks - classes like Session are also pretty commonly used).

I've done it for myself anyway, and created a pull at #28

@mheadd
Copy link

mheadd commented Nov 23, 2011

Thanks!

Will work to pull this into a separate PHP 5.3 specific branch for this lib.

@djbusby
Copy link

djbusby commented Oct 2, 2013

+1 for PHP Namespaces, all vendors should be doing this, thanks to acoulton the patch

@ghost ghost assigned kevinbond Jan 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants