├── .docker └── nginx │ └── etc │ └── nginx │ └── conf.d │ └── vhost.conf ├── .env.dev ├── .env.dist ├── .env.example ├── .gitignore ├── .scrutinizer.yml ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── core ├── docs └── DirectoryStructure.md ├── hidev.yml ├── public ├── assets │ └── .gitignore ├── favicon.ico ├── index.php └── robots.txt └── runtime └── .gitignore /.docker/nginx/etc/nginx/conf.d/vhost.conf: -------------------------------------------------------------------------------- 1 | map $http_x_forwarded_proto $fe_https { 2 | default off; 3 | https on; 4 | } 5 | 6 | server { 7 | listen 80; 8 | index index.php index.html; 9 | server_name localhost; 10 | error_log /var/log/nginx/error.log; 11 | access_log /var/log/nginx/access.log; 12 | root /app/public; 13 | 14 | client_max_body_size 32m; 15 | 16 | real_ip_header X-Forwarded-For; 17 | set_real_ip_from 172.16.0.0/12; 18 | set_real_ip_from 192.168.0.0/16; 19 | 20 | location ~ favicon\.ico { 21 | try_files $uri /favicon.ico; 22 | } 23 | 24 | location ~ ^/assets/.*\.php$ { 25 | deny all; 26 | } 27 | 28 | location /assets { 29 | try_files $uri =404; 30 | } 31 | 32 | location ~ ^/(merchant|finance)/pay { 33 | try_files $uri /index.php$is_args$args; 34 | } 35 | 36 | location / { 37 | try_files $uri /index.php$is_args$args; 38 | } 39 | 40 | location ~ \.php$ { 41 | include fastcgi_params; 42 | 43 | fastcgi_read_timeout 900; 44 | fastcgi_pass php-fpm:9000; 45 | 46 | fastcgi_index index.php; 47 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 48 | fastcgi_param PATH_INFO $fastcgi_path_info; 49 | fastcgi_param HTTP_REFERER $http_referer; 50 | fastcgi_param HTTPS $fe_https; 51 | fastcgi_param PHP_VALUE " 52 | error_log = /var/log/php/php.log 53 | error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT 54 | "; 55 | 56 | proxy_set_header Host $host; 57 | proxy_set_header X-Real-IP $remote_addr; 58 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 59 | 60 | try_files $uri =404; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /.env.dev: -------------------------------------------------------------------------------- 1 | HOSTS=dev-hisite.hiqdev.com 2 | REAL_IP=88.208.12.140 3 | 4 | ENV=dev 5 | SSL=true 6 | 7 | DEBUG_ENABLED=1 8 | DEBUG_ALLOWED_IPS="127.0.0.1,62.122.156.38" 9 | 10 | COOKIEVALIDATIONKEY="QuokOoDrookjeinecufroHyp6Quor8" 11 | 12 | YANDEXMETRIKA_ID=44557069, 13 | YANDEXMETRIKA_PARAMS_WEBVISOR=1 14 | YANDEXMETRIKA_PARAMS_CLICKMAP=1 15 | YANDEXMETRIKA_PARAMS_TRACKLINKS=1 16 | YANDEXMETRIKA_PARAMS_ACCURATETRACKBOUNCE=1 17 | 18 | GOOGLEANALYTICS_ID="UA-103639158-2" 19 | -------------------------------------------------------------------------------- /.env.dist: -------------------------------------------------------------------------------- 1 | HOSTS=hisite.hiqdev.com 2 | 3 | ENV=dev 4 | SSL=true 5 | 6 | DEBUG_ENABLED=1 7 | DEBUG_ALLOWED_IPS="127.0.0.1" 8 | 9 | COOKIEVALIDATIONKEY="TagKnynt4Otian3GryRepasdf" 10 | 11 | YANDEXMETRIKA_ID=44557069, 12 | YANDEXMETRIKA_PARAMS_WEBVISOR=1 13 | YANDEXMETRIKA_PARAMS_CLICKMAP=1 14 | YANDEXMETRIKA_PARAMS_TRACKLINKS=1 15 | YANDEXMETRIKA_PARAMS_ACCURATETRACKBOUNCE=1 16 | 17 | GOOGLEANALYTICS_ID="UA-103639158-2" 18 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | ENV=dev 2 | SSL= 3 | HOSTS=hisite.hiqdev.com 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # local config 2 | /.env 3 | /docker-compose.yml 4 | 5 | # IDE & OS files 6 | .*.swp 7 | .DS_Store 8 | .buildpath 9 | .idea 10 | .project 11 | .settings 12 | Thumbs.db 13 | nbproject 14 | 15 | # dynamic files 16 | /composer.lock 17 | /vendor 18 | /.docker 19 | .php_cs.cache 20 | .phpunit.result.cache 21 | coverage.clover 22 | 23 | # Binaries 24 | chkipper.phar 25 | composer.phar 26 | ocular.phar 27 | php-cs-fixer.phar 28 | phpstan.phar 29 | phpunit-skelgen.phar 30 | phpunit.phar 31 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | checks: 2 | php: 3 | code_rating: true 4 | duplication: true 5 | tools: 6 | php_code_coverage: 7 | enabled: true 8 | external_code_coverage: 9 | timeout: 600 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - 5.6 4 | - 7 5 | - 7.1 6 | - hhvm 7 | dist: trusty 8 | matrix: 9 | allow_failures: 10 | - 11 | php: hhvm 12 | cache: 13 | directories: 14 | - $HOME/.composer/cache 15 | before_install: 16 | - 'composer self-update' 17 | - 'composer --version' 18 | - 'composer install --no-interaction' 19 | - './vendor/bin/hidev --version' 20 | - './vendor/bin/hidev travis/before-install' 21 | sudo: false 22 | install: 23 | - './vendor/bin/hidev travis/install' 24 | script: 25 | - './vendor/bin/hidev travis/script' 26 | after_script: 27 | - './vendor/bin/hidev travis/after-script' 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright © 2016-2017, HiQDev (http://hiqdev.com/) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of HiQDev nor the names of its 15 | contributors may be used to endorse or promote products derived 16 | from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HiSite Template 2 | 3 | **HiSite Project Template** 4 | 5 | [![Latest Stable Version](https://poser.pugx.org/hiqdev/hisite-template/v/stable)](https://packagist.org/packages/hiqdev/hisite-template) 6 | [![Total Downloads](https://poser.pugx.org/hiqdev/hisite-template/downloads)](https://packagist.org/packages/hiqdev/hisite-template) 7 | [![Build Status](https://img.shields.io/travis/hiqdev/hisite-template.svg)](https://travis-ci.org/hiqdev/hisite-template) 8 | [![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/hiqdev/hisite-template.svg)](https://scrutinizer-ci.com/g/hiqdev/hisite-template/) 9 | [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/hiqdev/hisite-template.svg)](https://scrutinizer-ci.com/g/hiqdev/hisite-template/) 10 | [![Dependency Status](https://www.versioneye.com/php/hiqdev:hisite-template/dev-master/badge.svg)](https://www.versioneye.com/php/hiqdev:hisite-template/dev-master) 11 | 12 | [HiSite] is a base project for building modular [Yii2] web applications from plugins. 13 | 14 | This package is a template to start your HiSite project with. 15 | 16 | It includes: 17 | 18 | - [hisite] - HiSite basic project 19 | - [yii2-theme-flat] - Flat theme 20 | - [yii2-pnotify] - flash notifications with JQuery [PNotify] 21 | - [yii2-language] - language detecting and switching 22 | - [yii2-monitoring] - application monitoring 23 | 24 | [yii2]: http://www.yiiframework.com/ 25 | [HiSite]: https://github.com/hiqdev/hisite 26 | [yii2-theme-flat]: https://github.com/hiqdev/yii2-theme-flat 27 | [yii2-theme-original]: https://github.com/hiqdev/yii2-theme-original 28 | [yii2-pnotify]: https://github.com/hiqdev/yii2-thememanager 29 | [yii2-language]: https://github.com/hiqdev/yii2-language 30 | [yii2-monitoring]: https://github.com/hiqdev/yii2-monitoring 31 | [pnotify]: https://github.com/sciactive/pnotify 32 | 33 | [![Live Demo](https://img.shields.io/badge/live-demo-brightgreen.svg)](https://hisite.hiqdev.com/) 34 | 35 | ## Installation 36 | 37 | Preferred way to install this project is through [composer]: 38 | 39 | ```sh 40 | composer create-project --stability=dev "hiqdev/hisite-template:*" dir 41 | ``` 42 | 43 | To finish project installation run: 44 | 45 | ```sh 46 | ./vendor/bin/hidev deploy 47 | ``` 48 | 49 | You will see: 50 | 51 | ``` 52 | Created dir: ./public/ 53 | Created dir: ./public/assets/ 54 | chmod ./public/assets '0777' 55 | chmod ./runtime '0777' 56 | ``` 57 | 58 | And that's it — the project is ready to be served with web server. 59 | But [hidev] can do a bit more for you. 60 | 61 | Also see more on recommended [Directory structure] of this template. 62 | 63 | [Directory structure]: docs/DirectoryStructure.md 64 | 65 | ### Generate and install NGINX vhost config 66 | 67 | Copy [.env.dist] to `.env` and tune it to set project wide options: 68 | 69 | - `ENV` - environment env/prod, will be used to setup `YII_ENV` constant 70 | - `SSL` - enable SSL, used for NGINX config 71 | - `HOSTS` - hostname(s), used for NGINX config 72 | 73 | To see generated NGINX config without actually installing it use the following command: 74 | 75 | ```sh 76 | ./vendor/bin/hidev nginx/dump 77 | ``` 78 | 79 | To install config and restart NGINX run: 80 | 81 | ```sh 82 | ./vendor/bin/hidev nginx/deploy 83 | ``` 84 | 85 | [composer]: http://getcomposer.org/download/ 86 | [.env.dist]: .env.dist 87 | [hidev]: https://github.com/hiqdev/hidev 88 | [chkipper]: https://github.com/hiqdev/chkipper 89 | 90 | ## License 91 | 92 | This project is released under the terms of the BSD-3-Clause [license](LICENSE). 93 | Read more [here](http://choosealicense.com/licenses/bsd-3-clause). 94 | 95 | Copyright © 2016-2017, HiQDev (http://hiqdev.com/) 96 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hiqdev/hisite-template", 3 | "type": "project", 4 | "description": "HiSite Project Template", 5 | "homepage": "https://github.com/hiqdev/hisite-template", 6 | "license": "BSD-3-Clause", 7 | "support": { 8 | "source": "https://github.com/hiqdev/hisite-template", 9 | "issues": "https://github.com/hiqdev/hisite-template/issues", 10 | "wiki": "https://github.com/hiqdev/hisite-template/wiki", 11 | "email": "support@hiqdev.com", 12 | "forum": "http://forum.hiqdev.com/" 13 | }, 14 | "authors": [ 15 | { 16 | "name": "Andrii Vasyliev", 17 | "role": "Project lead", 18 | "email": "sol@hiqdev.com", 19 | "homepage": "http://hipanel.com/" 20 | }, 21 | { 22 | "name": "Dmitry Naumenko", 23 | "role": "Lead backend developer", 24 | "email": "d.naumenko.a@gmail.com", 25 | "homepage": "http://silverfire.me/" 26 | }, 27 | { 28 | "name": "Andrey Klochok", 29 | "role": "Lead frontend developer", 30 | "email": "andreyklochok@gmail.com", 31 | "homepage": "http://hiqdev.com/" 32 | }, 33 | { 34 | "name": "Yuriy Myronchuk", 35 | "role": "QA Lead", 36 | "email": "bladeroot@gmail.com", 37 | "homepage": "http://hiqdev.com/" 38 | } 39 | ], 40 | "require": { 41 | "hiqdev/hisite": "<2.0 || dev-master || 3.0.x-dev", 42 | "hiqdev/yii2-pnotify": "<2.0 || dev-master", 43 | "hiqdev/yii2-language": "<2.0 || dev-master", 44 | "hiqdev/yii2-monitoring": "<2.0 || dev-master", 45 | "hiqdev/yii2-theme-flat": "<2.0 || dev-master" 46 | }, 47 | "require-dev": { 48 | "yiisoft/yii2-debug": "^2.0", 49 | "hiqdev/hidev": "<2.0 || dev-master", 50 | "hiqdev/hidev-php": "<2.0 || dev-master" 51 | }, 52 | "keywords": [], 53 | "autoload": { 54 | "psr-4": { 55 | "hiqdev\\sites\\hisite\\hiqdevcom\\": "src" 56 | } 57 | }, 58 | "minimum-stability": "dev", 59 | "repositories": [ 60 | { 61 | "type": "composer", 62 | "url": "https://asset-packagist.org" 63 | } 64 | ] 65 | } 66 | -------------------------------------------------------------------------------- /core: -------------------------------------------------------------------------------- 1 | vendor/hiqdev/hisite -------------------------------------------------------------------------------- /docs/DirectoryStructure.md: -------------------------------------------------------------------------------- 1 | # Directory Structure 2 | 3 | - commited files: 4 | - `core` -> vendor/hiqdev/%the-core-package%/ 5 | - `composer.json` 6 | - `composer.lock` - commited at releases 7 | - `.docker/nginx/etc/nginx/conf.d/vhost.conf` - almost standart but doesn't work when symlinked :( 8 | - `.env.X` 9 | - `.env.dist` - production config 10 | - `.env.local` - local installation config 11 | - `.gitignore` -> core/.gitignore 12 | - `phpunit.xml.dist` -> core/phpunit.xml.dist 13 | - `public/` 14 | - `assets/.gitignore` - ignore everything, for git to keep the directory 15 | - `favicon.ico` 16 | - `index.php` -> ../core/public/index.php 17 | - `robots.txt` -> ../core/public/robots.txt 18 | - `runtime/.gitignore` - ignore everything, for git to keep the directory 19 | - `tests/` -> core/tests 20 | - uncommited symlinks: 21 | - `.env` -> `.env.X` 22 | - `.env.dist` for **production** 23 | - `.env.local` for **local** development 24 | - `.env.dev` for **staging** server 25 | - `docker-compose.yml` -> `core/docker-compose.yml.X` similarly 26 | 27 | ## Ideas 28 | 29 | - we have many similar project installations 30 | - we want to keep root packages as DRY as possible to avoid the need for propagating changes in all the roots 31 | - that's why we have `core` symlink to core package: 32 | - `hiqdev/hipanel-core` in **hipanel** 33 | - `hiqdev/hipanel-site` in **site** 34 | - `hiqdev/hiam` in **hiam** 35 | - `hiqdev/hiapi-legacy` in **hiapi** 36 | - thus standart files and dirs are symlinked from core, reusable between all installations: 37 | - public/index.php 38 | - public/robots.txt 39 | - tests/ 40 | - phpunit.xml.dist 41 | - docker-compose.yml 42 | - .gitignore 43 | - so project personalization comes down to tweaking several files 44 | - thouroughly handcrafted files with project configuration: 45 | - composer.json 46 | - .env.X 47 | - .env.dist - production config 48 | - .env.local - config for local installation 49 | - .env.dev - staging 50 | - .env.myname-dev - personal configurations allowed 51 | - hidev.yml - not really needed, to be removed 52 | - config/params.php - not really needed, to be removed 53 | - thoughtfully simlinked files: 54 | - .env - choose one of .env.XXX 55 | - docker-compose.yml - normally is a symlink, but may be deriviated from `core/docker-compose.yml.X` 56 | - copy pasted files, to be automated: 57 | - .docker/nginx/etc/nginx/conf.d/vhost.conf - can include IP restrictions 58 | - public/favicon.ico 59 | - also project has evolving files: 60 | - public/assets/ - needs chmod a+w 61 | - runtime/ - needs chmod a+w 62 | - composer.lock - commited at releases 63 | - and other, possibly generated files, not really needed, may be absent: 64 | - README.md 65 | - LICENSE 66 | - ssl/ - normally not needed 67 | - fullchain.pem 68 | - privkey.pem 69 | 70 | -------------------------------------------------------------------------------- /hidev.yml: -------------------------------------------------------------------------------- 1 | package: 2 | type: project 3 | name: hisite-template 4 | title: HiSite Project Template 5 | headline: HiSite Template 6 | license: BSD-3-Clause 7 | description: | 8 | [HiSite] is a base project for building modular [Yii2] web applications from plugins. 9 | 10 | This package is a template to start your HiSite project with. 11 | 12 | It includes: 13 | 14 | - [hisite] - HiSite basic project 15 | - [yii2-theme-flat] - Flat theme 16 | - [yii2-pnotify] - flash notifications with JQuery [PNotify] 17 | - [yii2-language] - language detecting and switching 18 | - [yii2-monitoring] - application monitoring 19 | 20 | [yii2]: http://www.yiiframework.com/ 21 | [HiSite]: https://github.com/hiqdev/hisite 22 | [yii2-theme-flat]: https://github.com/hiqdev/yii2-theme-flat 23 | [yii2-theme-original]: https://github.com/hiqdev/yii2-theme-original 24 | [yii2-pnotify]: https://github.com/hiqdev/yii2-thememanager 25 | [yii2-language]: https://github.com/hiqdev/yii2-language 26 | [yii2-monitoring]: https://github.com/hiqdev/yii2-monitoring 27 | [pnotify]: https://github.com/sciactive/pnotify 28 | 29 | [![Live Demo](https://img.shields.io/badge/live-demo-brightgreen.svg)](https://hisite.hiqdev.com/) 30 | 31 | webapp: 32 | vhost: 33 | ssl: $_ENV['SSL'] 34 | domains: $_ENV['HOSTS'] 35 | 36 | vendor: 37 | name: hiqdev 38 | title: HiQDev 39 | homepage: http://hiqdev.com/ 40 | authors: 41 | hiqsol: 42 | name: Andrii Vasyliev 43 | role: Project lead 44 | email: sol@hiqdev.com 45 | github: https://github.com/hiqsol 46 | homepage: http://hipanel.com/ 47 | SilverFire: 48 | name: Dmitry Naumenko 49 | role: Lead backend developer 50 | email: d.naumenko.a@gmail.com 51 | github: https://github.com/SilverFire 52 | homepage: http://silverfire.me/ 53 | tafid: 54 | name: Andrey Klochok 55 | role: Lead frontend developer 56 | email: andreyklochok@gmail.com 57 | github: https://github.com/tafid 58 | homepage: http://hiqdev.com/ 59 | BladeRoot: 60 | name: Yuriy Myronchuk 61 | role: QA Lead 62 | email: bladeroot@gmail.com 63 | github: https://github.com/BladeRoot 64 | homepage: http://hiqdev.com/ 65 | -------------------------------------------------------------------------------- /public/assets/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | ../core/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | ../core/public/index.php -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | ../core/public/robots.txt -------------------------------------------------------------------------------- /runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | --------------------------------------------------------------------------------