Skip to content

Update package files #21

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

Merged
merged 1 commit into from
Jan 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

# we diverge from the yml 2 spaces convention of php-http in favor of the symfony code style.
8 changes: 7 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
spec/ export-ignore
Tests/ export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.scrutinizer.yml export-ignore
.styleci.yml export-ignore
.travis.yml export-ignore
CONTRIBUTING.md export-ignore
Tests/ export-ignore
phpspec.yml.ci export-ignore
phpspec.yml.dist export-ignore
phpunit.xml.dist export-ignore
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.puli/
build/
vendor/
composer.lock
phpspec.yml
phpunit.xml
13 changes: 13 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/*
* In order to make it work, fabpot/php-cs-fixer and sllh/php-cs-fixer-styleci-bridge must be installed globally
* with composer.
*
* @link https://github.com/Soullivaneuh/php-cs-fixer-styleci-bridge
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer
*/

use SLLH\StyleCIBridge\ConfigBridge;

return ConfigBridge::create();
13 changes: 5 additions & 8 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
filter:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need both scrutinizer AND styleci? it looks like scrutinizer is not active in thsi repository

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scrutinizer does some basic code checks, but I don't insist on it.

Copy link
Collaborator

@dbu dbu Jan 8, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the style checking. Will enable scrutinizer.

exclude_paths: [vendor/*, Tests/*]
paths: [src/*]
checks:
php:
code_rating: true
duplication: true
php:
code_rating: true
duplication: true
tools:
external_code_coverage: true
php_code_sniffer:
config:
standard: "PSR2"
external_code_coverage: true
12 changes: 12 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
preset: symfony

finder:
exclude:
- "spec"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no spec folder. but a Resources folder

- "Tests"
- "Resources"
path:
- "./"

enabled:
- short_array_syntax
56 changes: 33 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
language: php

sudo: false

cache:
directories:
- $HOME/.composer/cache

php:
- 5.5
- 5.6
- 7.0
- hhvm
- 5.5
- 5.6
- 7.0
- hhvm

env:
global:
- TEST_COMMAND="composer test"
matrix:
- SYMFONY_VERSION=3.0.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=2.7.*
global:
- TEST_COMMAND="composer test"
matrix:
- SYMFONY_VERSION=3.0.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=2.7.*

branches:
except:
- /^analysis-.*$/

matrix:
fast_finish: true
allow_failures:
- php: hhvm
- env: SYMFONY_VERSION=3.0.*
- php: 5.5
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" && COVERAGE=true && TEST_COMMAND="composer test-ci" && SYMFONY_VERSION=2.7.*
fast_finish: true
allow_failures:
- php: hhvm
- env: SYMFONY_VERSION=3.0.*
- php: 5.5
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" SYMFONY_VERSION=2.7.*

before_install:
- travis_retry composer self-update
- wget https://github.com/puli/cli/releases/download/1.0.0-beta9/puli.phar && chmod +x puli.phar
- travis_retry composer self-update
- wget https://github.com/puli/cli/releases/download/1.0.0-beta9/puli.phar && chmod +x puli.phar

install:
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction

script:
- $TEST_COMMAND
- $TEST_COMMAND

after_success:
- if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi
- if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi
1 change: 1 addition & 0 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please see http://docs.php-http.org/en/latest/development/contributing.html
85 changes: 0 additions & 85 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 PHP HTTP Team <[email protected]>
Copyright (c) 2015-2016 PHP HTTP Team <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ composer require php-http/httplug-bundle
```

Enable the bundle in your kernel:

``` php
<?php
// app/AppKernel.php
Expand All @@ -37,32 +37,32 @@ public function registerBundles()

The usage documentation is split into two parts. First we explain how to configure the bundle in an application. The second part is for developing reusable Symfony bundles that depend on an HTTP client defined by the Httplug interface.

For information how to write applications with the services provided by this bundle, have a look at the [Httplug documentation](http://docs.httplug.io).
For information how to write applications with the services provided by this bundle, have a look at the [Httplug documentation](http://docs.php-http.org).


### Use in Applications

#### Custom services


| Service id | Description |
| ---------- | ----------- |
| httplug.message_factory | Service* that provides the `Http\Message\MessageFactory`
| httplug.uri_factory | Service* that provides the `Http\Message\UriFactory`
| httplug.stream_factory | Service* that provides the `Http\Message\StreamFactory`
| httplug.client.[name] | This is your Httpclient that you have configured. With the configuration below the name would be `acme_client`.
| httplug.client | This is the first client configured or a client named `default`.
| httplug.plugin.content_length <br> httplug.plugin.decoder<br> httplug.plugin.error<br> httplug.plugin.logger<br> httplug.plugin.redirect<br> httplug.plugin.retry | These are build in plugins that lives in the `php-http/plugins` package. These servcies are not public and may only be used when configure HttpClients or services.
| httplug.plugin.content_length <br> httplug.plugin.decoder<br> httplug.plugin.error<br> httplug.plugin.logger<br> httplug.plugin.redirect<br> httplug.plugin.retry | These are build in plugins that lives in the `php-http/plugins` package. These servcies are not public and may only be used when configure HttpClients or services.

\* *These services are always an alias to another service. You can specify your own service or leave the default, which is the same name with `.default` appended. The default services in turn use the service discovery mechanism to provide the best available implementation. You can specify a class for each of the default services to use instead of discovery, as long as those classes can be instantiated without arguments.*

If you need a more custom setup, define the services in your application configuration and specify your service in the `main_alias` section. For example, to add authentication headers, you could define a service that decorates the service `httplug.client.default` with a plugin that injects the authentication headers into the request and configure `httplug.main_alias.client` to the name of your service.

```yaml
httplug:
clients:
clients:
acme_client: # This is the name of the client
factory: 'httplug.factory.guzzle6'

main_alias:
client: httplug.client.default
message_factory: httplug.message_factory.default
Expand All @@ -71,33 +71,34 @@ httplug:
classes:
# uses discovery if not specified
client: ~
message_factory: ~
message_factory: ~
uri_factory: ~
stream_factory: ~
```


#### Configure your client

You can configure your clients with some good default options. The clients are later registered as services.
You can configure your clients with some good default options. The clients are later registered as services.

```yaml
httplug:
clients:
my_guzzle5:
clients:
my_guzzle5:
factory: 'httplug.factory.guzzle5'
config:
# These options are given to Guzzle without validation.
# These options are given to Guzzle without validation.
defaults:
base_uri: 'http://google.se/'
verify_ssl: false
timeout: 4
headers:
Content-Type: 'application/json'
acme:
acme:
factory: 'httplug.factory.guzzle6'
config:
base_uri: 'http://google.se/'

```

```php
Expand All @@ -106,21 +107,22 @@ $httpClient = $this->container->get('httplug.client.my_guzzle5');
$httpClient = $this->container->get('httplug.client.acme');
```


#### Plugins

You can configure the clients with plugins.
You can configure the clients with plugins.

```yaml
// services.yml
acme_plugin:
class: Acme\Plugin\MyCustonPlugin
class: Acme\Plugin\MyCustonPlugin
arguments: ["%api_key%"]
```
```yaml
// config.yml
httpug:
clients:
acme:
clients:
acme:
factory: 'httplug.factory.guzzle6'
plugins: ['acme_plugin' , 'httplug.plugin.logger']
config:
Expand All @@ -134,6 +136,7 @@ Rather than code against specific HTTP clients, you want to use the Httplug `Cli

The only steps they need is `require` one of the adapter implementations in their projects `composer.json` and instantiating the HttplugBundle in their kernel.


## Testing

``` bash
Expand All @@ -143,7 +146,7 @@ $ composer test

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).


## Security
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
"description": "Symfony bundle to integrate the Httplug generic HTTP client into Symfony",
"type": "symfony-bundle",
"keywords": ["http", "discovery", "adapter", "message", "factory", "bundle", "httplug", "php-http"],
"homepage": "http://php-http.org",
"homepage": "http://httplug.io",
"license": "MIT",
"authors": [
{
"name": "David Buchmann",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.5",
"php-http/discovery": "^0.6.3",
Expand Down Expand Up @@ -43,5 +41,7 @@
"branch-alias": {
"dev-master": "1.0-dev"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}