Skip to content

Commit

Permalink
MvcCore v3.1.2 implementation, readme updates, composer.json updates,…
Browse files Browse the repository at this point in the history
… config comments updates, newly named view template
  • Loading branch information
tomFlidr committed Jan 23, 2017
1 parent ba6b12b commit 08320d9
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 74 deletions.
9 changes: 8 additions & 1 deletion .packager/config-php-with-composer-preserve-hdd.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

// If you want to use this config, you need to copy manualy everything 'from' => 'to':
// - '/development/static/fonts' => '/release/static/fonts'
// - '/development/static/img' => '/release/static/img'
// - '/development/Var/Tmp' => '/release/Var/Tmp'
// and you need to uncomment line 12 in Bootstrap.php
// before compilation to generate css/js files properly in tmp

$config = array(
'sourcesDir' => __DIR__ . '/../development',
'releaseFile' => __DIR__ . '/../release/index.php',
Expand All @@ -21,7 +28,7 @@
"^/vendor/tracy/.*", // tracy library (https://tracy.nette.org/)
"^/vendor/mvccore/ext-tracy.*", // mvccore tracy adapter and all tracy panel extensions
"^/vendor/nette/safe-stream.*", // nette safe stream used to complete assets in cache
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library

// Exclude everything from '/static/...' and '/Var/Tmp' directory:
// If you want to use this config, you need to copy manualy everything 'from' => 'to':
Expand Down
9 changes: 8 additions & 1 deletion .packager/config-php-with-composer-preserve-package.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

// If you want to use this config, you need to copy manualy everything 'from' => 'to':
// - '/development/static/fonts' => '/release/static/fonts'
// - '/development/static/img' => '/release/static/img'
// - '/development/Var/Tmp' => '/release/Var/Tmp'
// and you need to uncomment line 12 in Bootstrap.php
// before compilation to generate css/js files properly in tmp

$config = array(
'sourcesDir' => __DIR__ . '/../development',
'releaseFile' => __DIR__ . '/../release/index.php',
Expand All @@ -21,7 +28,7 @@
"^/vendor/tracy/.*", // tracy library (https://tracy.nette.org/)
"^/vendor/mvccore/ext-tracy.*", // mvccore tracy adapter and all tracy panel extensions
"^/vendor/nette/safe-stream.*", // nette safe stream used to complete assets in cache
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library

// Exclude everything from '/static/...' and '/Var/Tmp' directory:
// If you want to use this config, you need to copy manualy everything 'from' => 'to':
Expand Down
11 changes: 10 additions & 1 deletion .packager/config-php-with-composer-strict-hdd.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

// If you want to use this config, you need to copy manualy everything 'from' => 'to':
// - '/development/static/fonts' => '/release/static/fonts'
// - '/development/static/img' => '/release/static/img'
// - '/development/Var/Tmp' => '/release/Var/Tmp'
// - '/development/App/Views/Layouts' => '/release/App/Views/Layouts'
// - '/development/App/Views/Scripts' => '/release/App/Views/Scripts'
// and you need to uncomment line 12 in Bootstrap.php
// before compilation to generate css/js files properly in tmp

$config = array(
'sourcesDir' => __DIR__ . '/../development',
'releaseFile' => __DIR__ . '/../release/index.php',
Expand All @@ -21,7 +30,7 @@
"^/vendor/tracy/.*", // tracy library (https://tracy.nette.org/)
"^/vendor/mvccore/ext-tracy.*", // mvccore tracy adapter and all tracy panel extensions
"^/vendor/nette/safe-stream.*", // nette safe stream used to complete assets in cache
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library

// Exclude everything from '/static/...' and '/Var/Tmp' directory:
// If you want to use this config, you need to copy manualy everything 'from' => 'to':
Expand Down
2 changes: 1 addition & 1 deletion .packager/config-php-with-composer-strict-package.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"^/vendor/tracy/.*", // tracy library (https://tracy.nette.org/)
"^/vendor/mvccore/ext-tracy.*", // mvccore tracy adapter and all tracy panel extensions
"^/vendor/nette/safe-stream.*", // nette safe stream used to complete assets in cache
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library
"^/vendor/mrclay/.*", // HTML/JS/CSS minify library

// Exclude source css and js files, use only what is generated in '/Var/Tmp' dir
"^/static/js",
Expand Down
81 changes: 63 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,79 @@
# MvcCore - Example - Hello World
Basic MVC application and packaging demonstration.

## Features
- all packing ways are possible to use:
- PHAR
- PHP
- strict package (currently used for packed app in result dir)
- strict hdd
- preserve package
- preserve hdd
[![Latest Stable Version](https://img.shields.io/badge/Stable-v3.1.2-brightgreen.svg?style=plastic)](https://github.com/mvccore/example-helloworld/releases)
[![License](https://img.shields.io/badge/Licence-BSD-brightgreen.svg?style=plastic)](https://github.com/mvccore/example-helloworld/blob/master/LICENCE.md)
[![Packager Build](https://img.shields.io/badge/Packager%20Build-passing-brightgreen.svg?style=plastic)](https://github.com/mvccore/packager)
![PHP Version](https://img.shields.io/badge/PHP->=5.3-brightgreen.svg?style=plastic)

- [**MvcCore**](https://github.com/mvccore/mvccore) very basic application and packaging demonstration.
- **Result** is **completly portable** - `./release/index.php`
- Result application **currently packed in strict package mode**, all packing configurations included in `./.packager/`
- Packed with [**Packager library - mvccore/packager**](https://github.com/mvccore/packager)), all packing ways possible:
- **PHAR file**
- standard PHAR package with whole devel dir content
- **PHP file**
- **strict package**
- everything is contained in result `index.php`
- only `.htaccess` or `web.config` are necessary to use mod_rewrite
- **preserve package**
- result `index.php` file contains PHP files,
PHTML templates but no CSS/JS/fonts or images
- all wrapped file system functions are looking inside
package first, then they try to read data from HDD
- **preserve hdd**
- result `index.php` file contains PHP files,
PHTML templates but no CSS/JS/fonts or images
- all wrapped file system functions are looking on HDD first,
then they try to read data from package inself
- **strict hdd**
- result `index.php` file contains only PHP files,
but PHTML templates, all CSS/JS/fonts and images are on HDD
- no PHP file system function is wrapped

## Instalation
```shell
# load project
composer require mvccore/example-helloworld

# update dependencies for packing
composer update
# load example
composer create-project mvccore/example-helloworld

# go to development directory
cd development
# go to project development dir
cd example-helloworld/development

# update dependencies for application sources
# update dependencies for app development sources
composer update
```

## Build

### 1. Prepare application
- go to `example-helloworld/development`
- clear everything in `./Var/Tmp/`
- change `$app->Run();` to `$app->Run();` in `./index.php`
- visit all aplication routes where are different JS/CSS bundles
groups to generate `./Var/Tmp/` content for result app
- run build process

### 2. Build

#### Linux:
```shell
# go to project root dir
cd example-helloworld
# run build process into single PHP file
sh make.sh
# or Windows:
```

#### Windows:
```shell
# go to project root dir
cd example-helloworld
# run build process into single PHP file
make.cmd
```

#### Browser:
```shell
# visit script `make-php.php` in your project root directory:
http://localhost/example-helloworld/make-php.php
# now run your result in:
http://localhost/example-helloworld/release/
```
9 changes: 7 additions & 2 deletions development/App/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ public static function Init () {
// patch debug class
MvcCore::GetInstance()->SetDebugClass(MvcCoreExt_Tracy::class);

// use this line only if you want to pack application without JS/CSS/fonts/images
// inside package and you want to have all those files placed on hard drive manualy.
// You can use this variant in modes PHP_PRESERVE_PACKAGE, PHP_PRESERVE_HDD and PHP_STRICT_HDD
//MvcCoreExt_ViewHelpers_Assets::SetAssetUrlCompletion(FALSE);

// add another view helper namespace
MvcCore_View::AddHelpersClassBases('MvcCoreExt_ViewHelpers');

// setup homepage route
// setup homepage route (optional, everything in '/' is routed to 'Default:Default' by default)
MvcCore_Router::GetInstance(array(
new MvcCore_Route('home', 'Default', 'Home', "#^/$#")
new MvcCore_Route('home', 'Default', 'Default', "#^/$#")
));
}
}
2 changes: 1 addition & 1 deletion development/App/Controllers/Default.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class App_Controllers_Default extends App_Controllers_Base
{
public function HomeAction () {
public function DefaultAction () {
$this->view->Title = "MvcCore Hello World Example";
$this->view->Version = MvcCore::VERSION;
$this->view->CompileMode = MvcCore::GetInstance()->GetCompiled();
Expand Down
10 changes: 5 additions & 5 deletions development/composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"require": {
"php": ">=5.3.0",
"mvccore/mvccore": "^3.0",
"mvccore/ext-viewhelp-assets": "^3.0",
"mvccore/ext-tracy": "^3.0",
"mvccore/ext-tracy-mvccore": "^3.0",
"mvccore/ext-tracy-routing": "^3.0",
"mvccore/mvccore": "^3.1",
"mvccore/ext-viewhelp-assets": "^3.1",
"mvccore/ext-tracy": "^3.1",
"mvccore/ext-tracy-mvccore": "^3.1",
"mvccore/ext-tracy-routing": "^3.1",
"tracy/tracy": "^2.4",
"mrclay/minify": "^2.2",
"nette/safe-stream": "^2.3"
Expand Down
6 changes: 3 additions & 3 deletions make-php.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
// to pack PHP scripts and templates but without any static files,
// use this config bellow and:
// set: ...->SetPhpFileSystemMode(Packager_Php::FS_MODE_PRESERVE_PACKAGE)
// and follow copiing instructions inside config:
// and follow copying instructions inside config:
//include_once('.packager/config-php-with-composer-preserve-package.php');


// to pack PHP scripts and templates but without any static files,
// use this config bellow and:
// set: ...->SetPhpFileSystemMode(Packager_Php::FS_MODE_PRESERVE_HDD)
// and follow copiing instructions inside config:
// and follow copying instructions inside config:
//include_once('.packager/config-php-with-composer-preserve-hdd.php');


// to pack only PHP scripts without any static files and any templates,
// use this config bellow and
// set: ...->SetPhpFileSystemMode(Packager_Php::FS_MODE_STRICT_HDD)
// and follow copiing instructions inside config:
// and follow copying instructions inside config:
//include_once('.packager/config-php-with-composer-strict-hdd.php');


Expand Down
Loading

0 comments on commit 08320d9

Please sign in to comment.