We need namespace! #39

Closed
wants to merge 8 commits into
from

Conversation

Projects
None yet
5 participants
@kud
Contributor

kud commented Mar 22, 2012

No description provided.

@kud

This comment has been minimized.

Show comment Hide comment
@kud

kud Mar 23, 2012

Contributor

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

Contributor

kud commented Mar 23, 2012

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

@gyndav

This comment has been minimized.

Show comment Hide comment
@gyndav

gyndav Mar 23, 2012

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

gyndav commented Mar 23, 2012

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

@themattharris

This comment has been minimized.

Show comment Hide comment
@themattharris

themattharris Apr 3, 2012

Owner

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

Owner

themattharris commented Apr 3, 2012

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

@willdurand

This comment has been minimized.

Show comment Hide comment
@willdurand

willdurand Apr 3, 2012

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 ;)

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

This comment has been minimized.

Show comment Hide comment
@gyndav

gyndav 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.

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

This comment has been minimized.

Show comment Hide comment
@kud

kud Apr 3, 2012

Contributor

@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?

Contributor

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

This comment has been minimized.

Show comment Hide comment
@willdurand

willdurand Apr 3, 2012

@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!

@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

This comment has been minimized.

Show comment Hide comment
@kud

kud Apr 3, 2012

Contributor

@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. ;)

Contributor

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

This comment has been minimized.

Show comment Hide comment
@dietervds

dietervds Apr 17, 2012

+1 on including the composer file btw :-)

+1 on including the composer file btw :-)

@themattharris themattharris referenced this pull request Sep 4, 2012

Closed

Support for Composer #54

@themattharris

This comment has been minimized.

Show comment Hide comment
@themattharris

themattharris Sep 4, 2012

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.

Owner

themattharris commented Sep 4, 2012

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.

@philsturgeon philsturgeon referenced this pull request Oct 5, 2012

Closed

Adding Composer Support #85

themattharris pushed a commit that referenced this pull request Oct 28, 2012

themattharris
introduce composer.json. Issues #39,#77,#85. Props: akandels, conradk…
…leinespel, dguyon, kud, philsturgeon, willdurand
@themattharris

This comment has been minimized.

Show comment Hide comment
@themattharris

themattharris Oct 28, 2012

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.

Owner

themattharris commented Oct 28, 2012

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 referenced this pull request Oct 28, 2012

Closed

Namespace & PSR-0 #77

@ghost ghost assigned themattharris Oct 28, 2012

themattharris added a commit that referenced this pull request Nov 1, 2012

Version 0.7.2
- 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