========= This is a Boilerplate application written on Phalcon framework for the performance boost. This project created to develop applications in an easy way.
-
Multimodality
-
Multilanguage
-
Translation
Have fun :)
Best way to install Boilerplate would be Composer, if you didn't install it
Run code in the terminal:
composer create-project artdevue/phalcon-blank /path/to/install
composer update
bower update
First you need to clone the project, update vendors:
git clone https://github.com/artdevue/phalcon-blank.git ./project
cd project
composer update
bower update
-
= PHP 5.5.x/5.6.x/7.0.x development resources (PHP 5.3 and 5.4 are no longer supported)
-
= Phalcon 3.0.2
After setup you’ll have multimodule apps.
- API RESTful module - responds all JSON-like requests.
- BACKEND and FRONTEND - A multi-module application uses the same document root for more than one module.
If you want to install a new module, you need using the terminal run the following command
$ php apps/cli.php modules create modulename
modulename - replace it with the name of the module
For example, after executing the commands below in a terminal
$ php apps/cli.php modules create catalog
In the terminal, we see the report module installation
$ php apps/cli.php modules create catalog
Do you really want to install the module catalog? Type 'yes' to continue: yes
Thank you, continuing...
Reading configuration file...
Creating a backup of the configuration file...
Record changes in the configuration file...
Create directories and files for this new module...
Installing the module is complete!
Use with pleasure!
After installing new module will be immediately available at http://site.com/catalog
The syntax of this command:
$ php apps/cli.php modules create $nameModule $prefixRouter $hostName
- $nameModule - (String - Required value!) Your module name
- $prefixRouter - (String) If the router prefix different from the module name, then enter here. If If you select - null - then there will be no prefix.
- $hostName - (String) Host Name, if you want to have your module on another host. For example: http://catalog.site.com
- You must activate the "multilang => true" option in the configuration file.
- Parameter "default_lang => 'en'" is assigned the default language (now is en)
- Add an array of used languages in the project to the "languages" parameter of the configuration file
- The default language is displayed in URL address without prefixes. For example:
site.com, site.com/page
- If another language is used, then the prefix should be added at the beginning of the URL address. For example:
site.com/ua, site.com/ua/page
- Active language is called via config: In Controller $this->config->lang_active and in Volt config.lang_active
Using Translation (Source is taken here)
All files for translation are located in the directory specified in the configuration file with the parameter: name_lang_folder (default is the folder lang) and in the subfolder of the default language in the configuration file with the parameter: default_lang (default lang en)
The variable name consists of the file names and array keys in the file section.
The example of use in the controller:
$accepted = $this->trans->_("validation.accepted", ['attribute' => 'test']);
The example of use in the template volt:
{{ trans._("validation.accepted", ['attribute': 'test']) }}
The MIT License (MIT). Please see License File for more information.
Valentin Rasulov artdevue.com http://artdevue.com |