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

We need namespace! #39

Closed
wants to merge 8 commits into from
Closed

We need namespace! #39

wants to merge 8 commits into from

Conversation

kud
Copy link
Contributor

@kud kud commented Mar 22, 2012

No description provided.

@kud
Copy link
Contributor Author

kud commented Mar 23, 2012

Hmmm maybe it ain't the correct namespace but please add one. ;)

@gyndav
Copy link

gyndav commented Mar 23, 2012

At least, this library need to be autoloaded following PSR-0 namespace conventions or either prefix conventions.

@themattharris
Copy link
Owner

I'm interested in the motivation behind adhering to PSR-0 and including namespaces while PHP 5.2 is still so widely used.

@willdurand
Copy link

Ok folks, you can use this lib without adding anything, even with Composer, and/or a namespaced environment. The default NS is \ afterall.

Extract of my composer.json:

{                                                                                                                                                        
    "require": {
        "php": ">=5.3.2",
        "themattharris/thm-oauth": "0.0.61"
    },
    "repositories": {
        "tmh-oauth": {
            "type": "package",
            "package": {
                "name": "themattharris/thm-oauth",
                "version": "0.0.61",
                "dist": {
                    "url": "https://github.com/themattharris/tmhOAuth/zipball/v0.61",
                    "type": "zip"
                },  
                "source": {
                    "url": "https://github.com/themattharris/tmhOAuth.git",
                    "type": "git",
                    "reference": "v0.61"
                }   
            }   
        }   
    }
}

I guess you can add a classmap section to get classes autoloaded by default.

@themattharris to provide a composer.json file is more than enough IMO, and I would be glad to see this file in your awesome library.

@kud be fair, and don't add yourself to the authors list ;)

@gyndav
Copy link

gyndav commented Apr 3, 2012

@willdurand you're right for Composer but the main idea was to benefit from PHP 5.3 features maybe with creating a dedicated branch for this library rather than replacing it for < PHP 5.2.

@themattharris to provide a composer.json file is more than enough IMO, and I would be glad to see this file in your  awesome library.

Yes please do that ! I'm inviting you to read the Composer documentation in order to do so.

@kud
Copy link
Contributor Author

kud commented Apr 3, 2012

@willdurand Wait wait wait Will. I think there's a mistake in my merge. If I added me in authors list, it's onlye because I'm working on a restructuration of all the lib, available here; https://github.com/kud/tmhoauth (it's not finished), and I prefer that people come back to me if there's a composer mistake, but in any case I wanted to say it's my lib. For sure.

In fact, I'm working on the silex service provider (https://github.com/kud/tmhoauth-silex-service-provider) of this lib and I think I need to change the paths of the lib to respect PSR-0. But maybe yeah I'm wrong?

@willdurand
Copy link

@themattharris Composer is a new dependency manager for PHP. It allows you to specify dependencies on a per-project basis. It takes lots of inspiration from NPM and ruby's bundler.

All you need to support composer is a composer.json file. In order to allow easy installation, the repository needs to be added to packagist, which is the standard repository for composer. Packagist will fetch all the versions from your github repository tags.

Once it has been added, adding tmhOAuth to a project will be as easy as creating this composer.json file in the project's directory:

{
    "require": {
        "themattharris/tmhOAuth": "*"
    }
}

And running this command:

$ php composer.phar install

Note: Packagist will re-crawl github for new versions all the time. After submitting it once, you don't have to do anything else.

Check out the following information on composer and packagist:

@dguyon to have a PHP 5.3 compliant lib definitely makes sense, that's right.

@kud yeah, looks better on your own fork right, my apologies then. Didn't see you've worked a lot. Nice to see a Silex Provider for this lib btw, good job!

@kud
Copy link
Contributor Author

kud commented Apr 3, 2012

@willdurand No problem, I'll finish it soon as possible and will try to do a pull request but I could understand that @themattharris doesn't approve all these modifications. ;)

@dietervds
Copy link

+1 on including the composer file btw :-)

@themattharris themattharris mentioned this pull request Sep 4, 2012
@themattharris
Copy link
Owner

i'm going to tackle this on 0.7.1.
i'll comment again when i have a test branch with this setup in it.

themattharris pushed a commit that referenced this pull request Oct 28, 2012
…leinespel, dguyon, kud, philsturgeon, willdurand
@themattharris
Copy link
Owner

ok i've committed a variant of the pull request to the 0.7.2-devel branch. i'm closing this and issue #77 out in favor of tracking all of it under one ticket -- #85. please add any feedback or comments there.

@themattharris themattharris mentioned this pull request Oct 28, 2012
@ghost ghost assigned themattharris Oct 28, 2012
themattharris pushed a commit that referenced this pull request Nov 1, 2012
- use DIRECTORY_SEPARATOR for multi-environment support. (Issue #80) Props: whallz
- tidied up the curlHeader function to use explode instead of substr and store the keys in the format they are returned from the API
- removed content-length hack as it isn't needed if CURLOPT_POSTFIELDS is initialized on all POSTs
- removed the expects header hack as Twitter no longer requires it to be there
- introduce composer.json. (Issues #39, #77, #85) Props: akandels, conradkleinespel, dguyon, kud, philsturgeon, willdurand
- added support for specifying custom headers when using $tmhOAuth->request. (Issue #98)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants