├── README.md
├── expressive
├── .gitignore
├── LICENSE.md
├── README.md
├── bin
│ └── clear-config-cache.php
├── composer.json
├── composer.lock
├── config
│ ├── .gitignore
│ ├── autoload
│ │ ├── .gitignore
│ │ ├── dependencies.global.php
│ │ ├── development.local.php.dist
│ │ ├── local.php.dist
│ │ └── zend-expressive.global.php
│ ├── config.php
│ ├── container.php
│ ├── development.config.php.dist
│ ├── pipeline.php
│ └── routes.php
├── data
│ ├── .gitignore
│ └── cache
│ │ └── .gitkeep
├── phpcs.xml.dist
├── phpunit.xml.dist
├── public
│ ├── .htaccess
│ └── index.php
├── src
│ └── App
│ │ ├── ConfigProvider.php
│ │ └── Handler
│ │ ├── HomePageHandler.php
│ │ ├── HomePageHandlerFactory.php
│ │ └── PingHandler.php
├── templates
│ ├── app
│ │ └── home-page.phtml
│ ├── error
│ │ ├── 404.phtml
│ │ └── error.phtml
│ └── layout
│ │ └── default.phtml
└── test
│ └── AppTest
│ └── Handler
│ ├── HomePageHandlerFactoryTest.php
│ ├── HomePageHandlerTest.php
│ └── PingHandlerTest.php
└── mvc
├── .gitignore
├── Dockerfile
├── LICENSE.md
├── README.md
├── TODO.md
├── Vagrantfile
├── composer.json
├── composer.lock
├── config
├── application.config.php
├── autoload
│ ├── .gitignore
│ ├── README.md
│ ├── development.local.php.dist
│ ├── global.php
│ ├── local.php.dist
│ └── zend-developer-tools.local-development.php
├── development.config.php.dist
└── modules.config.php
├── data
└── cache
│ └── .gitignore
├── docker-compose.yml
├── module
├── Admin
│ ├── config
│ │ └── module.config.php
│ ├── src
│ │ ├── Controller
│ │ │ ├── AdminController.php
│ │ │ ├── AdminControllerFactory.php
│ │ │ ├── GroupsController.php
│ │ │ └── UsersController.php
│ │ └── Module.php
│ └── view
│ │ ├── admin
│ │ ├── admin
│ │ │ ├── index.phtml
│ │ │ └── runmigrations.phtml
│ │ ├── groups
│ │ │ ├── index.phtml
│ │ │ └── view.phtml
│ │ └── users
│ │ │ ├── activity.phtml
│ │ │ ├── groups.phtml
│ │ │ ├── index.phtml
│ │ │ ├── settings.phtml
│ │ │ └── timeline.phtml
│ │ └── layout
│ │ └── layout.phtml
├── Portal
│ ├── config
│ │ └── module.config.php
│ ├── src
│ │ ├── Controller
│ │ │ ├── IndexController.php
│ │ │ ├── ProfileController.php
│ │ │ └── UserRelatedControllerFactory.php
│ │ └── Module.php
│ ├── test
│ │ └── Controller
│ │ │ └── IndexControllerTest.php
│ └── view
│ │ ├── error
│ │ ├── 404.phtml
│ │ └── index.phtml
│ │ ├── layout
│ │ └── layout.phtml
│ │ └── portal
│ │ ├── index
│ │ └── index.phtml
│ │ └── profile
│ │ ├── edit.phtml
│ │ └── view.phtml
└── ZFT
│ ├── Module.php
│ ├── src
│ ├── Assets
│ │ ├── Image.php
│ │ └── ImageHydrator.php
│ ├── Authentication
│ │ └── AuthenticationServiceFactory.php
│ ├── Connections
│ │ └── LdapFactory.php
│ ├── JsonSelect.php
│ ├── Migrations
│ │ ├── Migrations.php
│ │ ├── MigrationsEvent.php
│ │ └── Platform
│ │ │ ├── Postgresql.php
│ │ │ └── SqlServerMigrations.php
│ └── User
│ │ ├── DataMapperInterface.php
│ │ ├── Group.php
│ │ ├── IdentityMapInterface.php
│ │ ├── MemoryIdentityMap.php
│ │ ├── PostgresDataMapper.php
│ │ ├── Repository.php
│ │ ├── RepositoryFactory.php
│ │ ├── User.php
│ │ └── UserDataMapper.php
│ └── test
│ ├── Assets
│ ├── ImageHydratorTest.php
│ └── ImageTest.php
│ ├── Authentication
│ └── AuthenticationFactoryTest.php
│ ├── CompositeHydratorTest.php
│ ├── Connections
│ └── LdapFactoryTest.php
│ ├── Migrations
│ └── MigrationsTest.php
│ ├── User
│ ├── RepositoryFactoryTest.php
│ └── UserRepositoryTest.php
│ └── UserTest.php
├── phpunit.xml.dist
└── public
├── .htaccess
├── LICENSE
├── css
├── AdminLTE.css
├── AdminLTE.min.css
├── bootstrap-theme.css
├── bootstrap-theme.css.map
├── bootstrap-theme.min.css
├── bootstrap-theme.min.css.map
├── bootstrap.css
├── bootstrap.css.map
├── bootstrap.min.css
├── bootstrap.min.css.map
├── skins
│ ├── _all-skins.css
│ ├── _all-skins.min.css
│ ├── skin-black-light.css
│ ├── skin-black-light.min.css
│ ├── skin-black.css
│ ├── skin-black.min.css
│ ├── skin-blue-light.css
│ ├── skin-blue-light.min.css
│ ├── skin-blue.css
│ ├── skin-blue.min.css
│ ├── skin-green-light.css
│ ├── skin-green-light.min.css
│ ├── skin-green.css
│ ├── skin-green.min.css
│ ├── skin-purple-light.css
│ ├── skin-purple-light.min.css
│ ├── skin-purple.css
│ ├── skin-purple.min.css
│ ├── skin-red-light.css
│ ├── skin-red-light.min.css
│ ├── skin-red.css
│ ├── skin-red.min.css
│ ├── skin-yellow-light.css
│ ├── skin-yellow-light.min.css
│ ├── skin-yellow.css
│ └── skin-yellow.min.css
└── style.css
├── favicon.ico
├── fonts
├── glyphicons-halflings-regular.eot
├── glyphicons-halflings-regular.svg
├── glyphicons-halflings-regular.ttf
├── glyphicons-halflings-regular.woff
└── glyphicons-halflings-regular.woff2
├── img
├── avatar.png
├── avatar04.png
├── avatar2.png
├── avatar3.png
├── avatar5.png
├── boxed-bg.jpg
├── boxed-bg.png
├── credit
│ ├── american-express.png
│ ├── cirrus.png
│ ├── mastercard.png
│ ├── mestro.png
│ ├── paypal.png
│ ├── paypal2.png
│ └── visa.png
├── default-50x50.gif
├── favicon.ico
├── icons.png
├── photo1.png
├── photo2.png
├── photo3.jpg
├── photo4.jpg
├── user1-128x128.jpg
├── user2-160x160.jpg
├── user3-128x128.jpg
├── user4-128x128.jpg
├── user5-128x128.jpg
├── user6-128x128.jpg
├── user7-128x128.jpg
├── user8-128x128.jpg
├── user_1.png
├── user_10.png
├── user_100.png
├── user_11.png
├── user_12.png
├── user_13.png
├── user_14.png
├── user_15.png
├── user_16.png
├── user_17.png
├── user_18.png
├── user_19.png
├── user_2.png
├── user_20.png
├── user_21.png
├── user_22.png
├── user_23.png
├── user_24.png
├── user_25.png
├── user_26.png
├── user_27.png
├── user_28.png
├── user_29.png
├── user_3.png
├── user_30.png
├── user_31.png
├── user_32.png
├── user_33.png
├── user_34.png
├── user_35.png
├── user_36.png
├── user_37.png
├── user_38.png
├── user_39.png
├── user_4.png
├── user_40.png
├── user_41.png
├── user_42.png
├── user_43.png
├── user_44.png
├── user_45.png
├── user_46.png
├── user_47.png
├── user_48.png
├── user_49.png
├── user_5.png
├── user_50.png
├── user_51.png
├── user_52.png
├── user_53.png
├── user_54.png
├── user_55.png
├── user_56.png
├── user_57.png
├── user_58.png
├── user_59.png
├── user_6.png
├── user_60.png
├── user_61.png
├── user_62.png
├── user_63.png
├── user_64.png
├── user_65.png
├── user_66.png
├── user_67.png
├── user_68.png
├── user_69.png
├── user_7.png
├── user_70.png
├── user_71.png
├── user_72.png
├── user_73.png
├── user_74.png
├── user_75.png
├── user_76.png
├── user_77.png
├── user_78.png
├── user_79.png
├── user_8.png
├── user_80.png
├── user_81.png
├── user_82.png
├── user_83.png
├── user_84.png
├── user_85.png
├── user_86.png
├── user_87.png
├── user_88.png
├── user_89.png
├── user_9.png
├── user_90.png
├── user_91.png
├── user_92.png
├── user_93.png
├── user_94.png
├── user_95.png
├── user_96.png
├── user_97.png
├── user_98.png
├── user_99.png
└── zf-logo.png
├── index.php
├── js
├── app.js
├── app.min.js
├── bootstrap.js
├── bootstrap.min.js
├── demo.js
├── jquery-2.2.4.min.js
└── pages
│ ├── dashboard.js
│ └── dashboard2.js
├── plugins
├── img
│ └── switch.png
└── multi-select
│ ├── jquery.multi-select.js
│ └── multi-select.dist.css
└── web.config
/README.md:
--------------------------------------------------------------------------------
1 | # Zend Framework and Expressive Tutorial Repository
2 |
3 | These are sources for tutorials published at [Alex Tech Adventures](http://alex-tech-adventures.com) and
4 | [YouTube](https://www.youtube.com/playlist?list=PLXRC3l-ZhN3o7yOeUSjLlXKLI1FCDcEQv).
5 | The tutorial is derived from original Zend Skeleton application. You can view full original install README file at [Original MVC Repository](https://github.com/zendframework/ZendSkeletonApplication). and at [Original Expressive Repository](https://github.com/zendframework/zend-expressive-skeleton)
6 |
7 | You can use issue tracker to report problems or suggestions.
8 |
9 | ---
10 |
11 | Thank you very much for the donation offers! These tutorials are very long to produce. Extra donations
12 | will help towards doing this work sustainably without going on extended breaks.
13 |
14 | [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PET8HPTAH3BVU)
15 |
--------------------------------------------------------------------------------
/expressive/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | composer.phar
3 | clover.xml
4 | coveralls-upload.json
5 | phpunit.xml
6 | vendor/
7 |
--------------------------------------------------------------------------------
/expressive/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015-2018, Zend Technologies USA, Inc.
2 |
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification,
6 | are permitted provided that the following conditions are met:
7 |
8 | - Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | - Redistributions in binary form must reproduce the above copyright notice, this
12 | list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | - Neither the name of Zend Technologies USA, Inc. nor the names of its
16 | contributors may be used to endorse or promote products derived from this
17 | software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/expressive/bin/clear-config-cache.php:
--------------------------------------------------------------------------------
1 | [
10 | // Use 'aliases' to alias a service name to another service. The
11 | // key is the alias name, the value is the service to which it points.
12 | 'aliases' => [
13 | // Fully\Qualified\ClassOrInterfaceName::class => Fully\Qualified\ClassName::class,
14 | ],
15 | // Use 'invokables' for constructor-less services, or services that do
16 | // not require arguments to the constructor. Map a service name to the
17 | // class name.
18 | 'invokables' => [
19 | // Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
20 | ],
21 | // Use 'factories' for services provided by callbacks/factory classes.
22 | 'factories' => [
23 | // Fully\Qualified\ClassName::class => Fully\Qualified\FactoryName::class,
24 | ],
25 | ],
26 | ];
27 |
--------------------------------------------------------------------------------
/expressive/config/autoload/development.local.php.dist:
--------------------------------------------------------------------------------
1 | [
19 | 'invokables' => [
20 | ],
21 | 'factories' => [
22 | ErrorResponseGenerator::class => Container\WhoopsErrorResponseGeneratorFactory::class,
23 | 'Zend\Expressive\Whoops' => Container\WhoopsFactory::class,
24 | 'Zend\Expressive\WhoopsPageHandler' => Container\WhoopsPageHandlerFactory::class,
25 | ],
26 | ],
27 |
28 | 'whoops' => [
29 | 'json_exceptions' => [
30 | 'display' => true,
31 | 'show_trace' => true,
32 | 'ajax_only' => true,
33 | ],
34 | ],
35 | ];
36 |
--------------------------------------------------------------------------------
/expressive/config/autoload/local.php.dist:
--------------------------------------------------------------------------------
1 | true,
13 |
14 | // Enable debugging; typically used to provide debugging information within templates.
15 | 'debug' => false,
16 |
17 | 'zend-expressive' => [
18 | // Provide templates for the error handling middleware to use when
19 | // generating responses.
20 | 'error_handler' => [
21 | 'template_404' => 'error::404',
22 | 'template_error' => 'error::error',
23 | ],
24 | ],
25 | ];
26 |
--------------------------------------------------------------------------------
/expressive/config/config.php:
--------------------------------------------------------------------------------
1 | 'data/cache/config-cache.php',
13 | ];
14 |
15 | $aggregator = new ConfigAggregator([
16 | \Zend\Expressive\ZendView\ConfigProvider::class,
17 | \Zend\Expressive\Router\FastRouteRouter\ConfigProvider::class,
18 | \Zend\HttpHandlerRunner\ConfigProvider::class,
19 | // Include cache configuration
20 | new ArrayProvider($cacheConfig),
21 |
22 | \Zend\Expressive\Helper\ConfigProvider::class,
23 | \Zend\Expressive\ConfigProvider::class,
24 | \Zend\Expressive\Router\ConfigProvider::class,
25 |
26 | // Swoole config to overwrite some services (if installed)
27 | class_exists(\Zend\Expressive\Swoole\ConfigProvider::class)
28 | ? \Zend\Expressive\Swoole\ConfigProvider::class
29 | : function(){ return[]; },
30 |
31 | // Default App module config
32 | App\ConfigProvider::class,
33 |
34 | // Load application config in a pre-defined order in such a way that local settings
35 | // overwrite global settings. (Loaded as first to last):
36 | // - `global.php`
37 | // - `*.global.php`
38 | // - `local.php`
39 | // - `*.local.php`
40 | new PhpFileProvider(realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local}.php'),
41 |
42 | // Load development config if it exists
43 | new PhpFileProvider(realpath(__DIR__) . '/development.config.php'),
44 | ], $cacheConfig['config_cache_path']);
45 |
46 | return $aggregator->getMergedConfig();
47 |
--------------------------------------------------------------------------------
/expressive/config/container.php:
--------------------------------------------------------------------------------
1 | true,
29 | ConfigAggregator::ENABLE_CACHE => false,
30 | ];
31 |
--------------------------------------------------------------------------------
/expressive/config/pipeline.php:
--------------------------------------------------------------------------------
1 | pipe(ErrorHandler::class);
25 | $app->pipe(ServerUrlMiddleware::class);
26 |
27 | // Pipe more middleware here that you want to execute on every request:
28 | // - bootstrapping
29 | // - pre-conditions
30 | // - modifications to outgoing responses
31 | //
32 | // Piped Middleware may be either callables or service names. Middleware may
33 | // also be passed as an array; each item in the array must resolve to
34 | // middleware eventually (i.e., callable or service name).
35 | //
36 | // Middleware can be attached to specific paths, allowing you to mix and match
37 | // applications under a common domain. The handlers in each middleware
38 | // attached this way will see a URI with the matched path segment removed.
39 | //
40 | // i.e., path of "/api/member/profile" only passes "/member/profile" to $apiMiddleware
41 | // - $app->pipe('/api', $apiMiddleware);
42 | // - $app->pipe('/docs', $apiDocMiddleware);
43 | // - $app->pipe('/files', $filesMiddleware);
44 |
45 | // Register the routing middleware in the middleware pipeline.
46 | // This middleware registers the Zend\Expressive\Router\RouteResult request attribute.
47 | $app->pipe(RouteMiddleware::class);
48 |
49 | // The following handle routing failures for common conditions:
50 | // - HEAD request but no routes answer that method
51 | // - OPTIONS request but no routes answer that method
52 | // - method not allowed
53 | // Order here matters; the MethodNotAllowedMiddleware should be placed
54 | // after the Implicit*Middleware.
55 | $app->pipe(ImplicitHeadMiddleware::class);
56 | $app->pipe(ImplicitOptionsMiddleware::class);
57 | $app->pipe(MethodNotAllowedMiddleware::class);
58 |
59 | // Seed the UrlHelper with the routing results:
60 | $app->pipe(UrlHelperMiddleware::class);
61 |
62 | // Add more middleware here that needs to introspect the routing results; this
63 | // might include:
64 | //
65 | // - route-based authentication
66 | // - route-based validation
67 | // - etc.
68 |
69 | // Register the dispatch middleware in the middleware pipeline
70 | $app->pipe(DispatchMiddleware::class);
71 |
72 | // At this point, if no Response is returned by any middleware, the
73 | // NotFoundHandler kicks in; alternately, you can provide other fallback
74 | // middleware to execute.
75 | $app->pipe(NotFoundHandler::class);
76 | };
77 |
--------------------------------------------------------------------------------
/expressive/config/routes.php:
--------------------------------------------------------------------------------
1 | get('/', App\Handler\HomePageHandler::class, 'home');
13 | * $app->post('/album', App\Handler\AlbumCreateHandler::class, 'album.create');
14 | * $app->put('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.put');
15 | * $app->patch('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.patch');
16 | * $app->delete('/album/:id', App\Handler\AlbumDeleteHandler::class, 'album.delete');
17 | *
18 | * Or with multiple request methods:
19 | *
20 | * $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact');
21 | *
22 | * Or handling all request methods:
23 | *
24 | * $app->route('/contact', App\Handler\ContactHandler::class)->setName('contact');
25 | *
26 | * or:
27 | *
28 | * $app->route(
29 | * '/contact',
30 | * App\Handler\ContactHandler::class,
31 | * Zend\Expressive\Router\Route::HTTP_METHOD_ANY,
32 | * 'contact'
33 | * );
34 | */
35 | return function (Application $app, MiddlewareFactory $factory, ContainerInterface $container) : void {
36 | $app->get('/', App\Handler\HomePageHandler::class, 'home');
37 | $app->get('/api/ping', App\Handler\PingHandler::class, 'api.ping');
38 | };
39 |
--------------------------------------------------------------------------------
/expressive/data/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !cache
3 | !cache/.gitkeep
4 | !.gitignore
5 |
--------------------------------------------------------------------------------
/expressive/data/cache/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alextech/zendframework-tutorial-en/852b62308b446bcdffbf3c68f993afe4a527bd28/expressive/data/cache/.gitkeep
--------------------------------------------------------------------------------
/expressive/phpcs.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
We encountered a 404 Not Found error.
6 |7 | You are looking for something that doesn't exist or may have moved. Check out one of the links on this page 8 | or head back to Home. 9 |
10 | -------------------------------------------------------------------------------- /expressive/templates/error/error.phtml: -------------------------------------------------------------------------------- 1 | headTitle(sprintf('%d %s', $this->status, $this->reason)); ?> 2 | 3 |We encountered a =$this->escapeHtml(sprintf('%d %s', $this->status, $this->reason))?> error.
6 | status == 404) : ?> 7 |8 | You are looking for something that doesn't exist or may have moved. Check out one of the links on this page 9 | or head back to Home. 10 |
11 | 12 | -------------------------------------------------------------------------------- /expressive/templates/layout/default.phtml: -------------------------------------------------------------------------------- 1 | headLink() 3 | ->prependStylesheet('https://use.fontawesome.com/releases/v5.0.6/css/all.css') 4 | ->prependStylesheet('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css'); 5 | $this->inlineScript() 6 | ->prependFile('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js') 7 | ->prependFile('https://code.jquery.com/jquery-3.3.1.min.js'); 8 | ?> 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | =$this->headTitle('zend-expressive')->setSeparator(' - ')->setAutoEscape(false)?> 17 | =$this->headMeta()?> 18 | =$this->headLink()?> 19 | 25 | 26 | 27 |