Skip to content

Commit 3aec679

Browse files
authored
Merge branch 'master' into php7
2 parents 62039e1 + 64a17eb commit 3aec679

File tree

114 files changed

+12115
-3266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+12115
-3266
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ composer.lock
22
composer.phar
33
vendor/*
44
.idea/*
5+
data/php-di

README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Require the libraries with Composer:
1616
{
1717
"require": {
1818
"php-di/php-di": "*",
19-
"php-di/zf-bridge": "*"
19+
"php-di/zend-framework-bridge": "*"
2020
}
2121
}
2222
```
@@ -26,15 +26,16 @@ To use PHP-DI in your Zend Framework application, you need to edit `application_
2626
```php
2727
// ...
2828
'modules' => [
29-
...
3029
'DI\ZendFramework',
30+
'Zend\Router',
31+
'Zend\Mvc\Console',
3132
...
3233
],
3334

3435
'service_manager' => [
3536
// ...
3637
'factories' => [
37-
'DI\Container' => 'DI\ZendFramework\Service\DIContainerFactory',
38+
'DI\Container' => DI\ZendFramewor\Service\DIContainerFactory::class,
3839
],
3940
],
4041
```
@@ -146,3 +147,13 @@ To clear the definition cache, run the following command from the project root:
146147
```
147148
php public/index.php php-di-clear-cache
148149
```
150+
151+
## Run sample application
152+
153+
Run `composer install --dev`
154+
155+
After that, open terminal and go to the `quickstart` folder and run `php -S 0.0.0.0:8080 -t public public/index.php`
156+
157+
Open a browser and go to this address: `http://localhost:8080/hello`
158+
159+
You should see a page with a greeting coming from the GreetingController, which is being resolved by the PHP-DI configuration.

composer.json

+17-9
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@
66
"license": "MIT",
77
"require": {
88
"php": ">=7.0",
9-
"php-di/php-di": "~5.0",
10-
"acclimate/container": "~1.0",
11-
"doctrine/annotations": "~1.0",
12-
"doctrine/cache": "~1.0"
9+
"php-di/php-di": "^5.0",
10+
"acclimate/container": "^1.0",
11+
"doctrine/annotations": "^1.0",
12+
"doctrine/cache": "^1.0",
13+
"roave/security-advisories": "dev-master"
1314
},
1415

1516
"require-dev": {
16-
"zendframework/zendframework": "~2.5",
17-
"squizlabs/php_codesniffer": "~2.0",
18-
"phpmd/phpmd" : "~2.0",
19-
"phpunit/phpunit": "~4.8"
17+
"zendframework/zendframework": "^3.0",
18+
"squizlabs/php_codesniffer": "^2.6",
19+
"phpmd/phpmd" : "^2.5",
20+
"phpunit/phpunit": "^5.0",
21+
"phpro/grumphp": "^0.11.2",
22+
"nikic/php-parser": "^3.0",
23+
"sebastian/phpcpd": "^3.0",
24+
"friendsofphp/php-cs-fixer": "^2.1",
25+
"jakub-onderka/php-parallel-lint": "^0.9.2",
26+
"sensiolabs/security-checker": "^4.0"
2027
},
2128

2229
"autoload": {
@@ -27,7 +34,8 @@
2734

2835
"autoload-dev": {
2936
"psr-4": {
30-
"Test\\DI\\ZendFramework\\": "tests/"
37+
"Test\\DI\\ZendFramework\\": "tests/DI/ZendFramework",
38+
"Application\\": "quickstart/module/Application/src"
3139
}
3240
}
3341
}

config/module.config.php

+9-18
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,21 @@
88
*/
99
namespace DI\ZendFramework;
1010

11-
// compatibility with zend > 2.5
12-
$controllerType = 'ControllerLoader';
13-
if (class_exists('\Zend\Version\Version')) {
14-
$version = new \Zend\Version\Version();
15-
if ($version::compareVersion('2.5.0') <= 0) {
16-
$controllerType = 'ControllerManager';
17-
}
18-
}
19-
2011
return [
2112
'controllers' => [
22-
'invokables' => [
23-
'DI\\ZendFramework\\Controller\\Console' => 'DI\\ZendFramework\\Controller\\ConsoleController',
24-
],
13+
'factories' => [
14+
Controller\ConsoleController::class => Service\ConsoleControllerFactory::class,
15+
]
2516
],
2617

2718
'service_manager' => [
28-
'abstract_factories' => array(
29-
__NAMESPACE__ . '\\Service\\PHPDIAbstractFactory' => __NAMESPACE__ . '\\Service\\PHPDIAbstractFactory',
30-
),
19+
'abstract_factories' => [
20+
Service\PHPDIAbstractFactory::class => Service\PHPDIAbstractFactory::class,
21+
],
3122

3223
'factories' => [
33-
$controllerType => __NAMESPACE__ . '\\Service\\ControllerLoaderFactory',
34-
'DiCache' => __NAMESPACE__ . '\\Service\\CacheFactory',
24+
'ControllerManager' => Service\ControllerManagerFactory::class,
25+
'DiCache' => Service\CacheFactory\CacheFactory::class,
3526
],
3627
],
3728

@@ -42,7 +33,7 @@
4233
'options' => [
4334
'route' => 'php-di-clear-cache',
4435
'defaults' => [
45-
'controller' => __NAMESPACE__ . '\Controller\Console',
36+
'controller' => Controller\ConsoleController::class,
4637
'action' => 'clearCache',
4738
'__NAMESPACE__' => __NAMESPACE__,
4839
]

grumphp.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
parameters:
2+
git_dir: .
3+
bin_dir: vendor/bin
4+
tasks:
5+
phpcpd: ~
6+
phpcs:
7+
standard: PSR2
8+
show_warnings: true
9+
tab_width: 4
10+
whitelist_patterns: []
11+
encoding: ~
12+
ignore_patterns: []
13+
sniffs: []
14+
triggered_by: [php]
15+
phpcsfixer2:
16+
allow_risky: false
17+
cache_file: ~
18+
config: ~
19+
rules:
20+
- '@@PSR2'
21+
using_cache: true
22+
path_mode: ~
23+
verbose: false
24+
diff: true
25+
triggered_by: ['php']
26+
phplint: ~
27+
phpmd:
28+
exclude: []
29+
ruleset: ['unusedcode', 'design', 'controversial', 'naming', 'codesize', 'cleancode']
30+
triggered_by: ['php']
31+
phpparser: ~
32+
phpunit: ~
33+
phpversion: ~
34+
securitychecker: ~
35+
shell: ~

quickstart/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.vagrant/
2+
vendor/
3+
config/development.config.php
4+
data/cache/*
5+
!data/cache/.gitkeep
6+
phpunit.xml

quickstart/CONDUCT.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Contributor Code of Conduct
2+
3+
The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com)
4+
as its guidelines for contributor interactions.
5+
6+
## The Code Manifesto
7+
8+
We want to work in an ecosystem that empowers developers to reach their
9+
potential — one that encourages growth and effective collaboration. A space that
10+
is safe for all.
11+
12+
A space such as this benefits everyone that participates in it. It encourages
13+
new developers to enter our field. It is through discussion and collaboration
14+
that we grow, and through growth that we improve.
15+
16+
In the effort to create such a place, we hold to these values:
17+
18+
1. **Discrimination limits us.** This includes discrimination on the basis of
19+
race, gender, sexual orientation, gender identity, age, nationality, technology
20+
and any other arbitrary exclusion of a group of people.
21+
2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort
22+
levels. Remember that, and if brought to your attention, heed it.
23+
3. **We are our biggest assets.** None of us were born masters of our trade.
24+
Each of us has been helped along the way. Return that favor, when and where
25+
you can.
26+
4. **We are resources for the future.** As an extension of #3, share what you
27+
know. Make yourself a resource to help those that come after you.
28+
5. **Respect defines us.** Treat others as you wish to be treated. Make your
29+
discussions, criticisms and debates from a position of respectfulness. Ask
30+
yourself, is it true? Is it necessary? Is it constructive? Anything less is
31+
unacceptable.
32+
6. **Reactions require grace.** Angry responses are valid, but abusive language
33+
and vindictive actions are toxic. When something happens that offends you,
34+
handle it assertively, but be respectful. Escalate reasonably, and try to
35+
allow the offender an opportunity to explain themselves, and possibly correct
36+
the issue.
37+
7. **Opinions are just that: opinions.** Each and every one of us, due to our
38+
background and upbringing, have varying opinions. The fact of the matter, is
39+
that is perfectly acceptable. Remember this: if you respect your own
40+
opinions, you should respect the opinions of others.
41+
8. **To err is human.** You might not intend it, but mistakes do happen and
42+
contribute to build experience. Tolerate honest mistakes, and don't hesitate
43+
to apologize if you make one yourself.

0 commit comments

Comments
 (0)