{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Installation","type":"basic","slug":"setup-installation","excerpt":"You can learn how to install phalcon slayer, how to initially setup your environment.","body":"# Installation\nYou can learn how to install phalcon slayer, how to initially setup your environment.\n\n## Index:\n- [Requirements](#requirements)\n\t- [Basic](#basic-requirements)\n\t- [For Queuing](#for-queuing)\n- [Project Creation](#project-creation)\n- [Dot Environment](#dot-environment)\n- [Web Server](#web-server)\n\n<a name=\"requirements\"></a>\n# Requirements:\n\nBefore installing, there are plenty of packages that we need to install first:\n<a name=\"basic-requirements\"></a>\n## Basic requirements:\n  * PHP version atleast 5.5.9\n  * [Phalcon Extension](https://phalconphp.com/en/download)\n  * [Composer](https://getcomposer.org/)\n  * [cURL](https://curl.haxx.se)\n \n<a name=\"for-queuing\"></a>\n## For Queuing:\n * You are required to install [Beanstalkd](http://kr.github.io/beanstalkd/)\n\nMost of these packages are already installed on your favorite os box.\n\n---\n<a name=\"project-creation\"></a>\n# Project Creation:\n\nUsing composer, you can create a new project, write this code on your terminal:\n\n```shell\ncomposer create-project phalconslayer/slayer --prefer-dist <folder name>\n```\n\nAfter running this command, there should be an output, similar below:\n\n```shell\nInstalling phalconslayer/slayer (version)\n  - Installing phalconslayer/slayer (version)\n    Downloading: 100%\n\nCreated project in folderName\n> php -r \"copy('.env.example', '.env');\"\nLoading composer repositories with package information\nInstalling dependencies (including require-dev)\n```\n\n---\n<a name=\"dot-environment\"></a>\n# Dot Environment:\n\nLet us say we have a  **local** / **staging** / **production** servers. The **local** comes with multiple ***developers***, however we don't want our developers to view those passwords or we call it \"credentials\", such as our production database, mail credentials, aws access token and many more.\n\nOn your project we have the \"**.env.example**\", let's copy this file and name it as \"**.env**\". Furthermore, this file handles a global constant value, let us say we have this:\n\n```shell\nDB_HOST=192.168.10.10\n```\n\nYou can access the constant value ``DB_HOST`` by using the function ``env(<constant name>, <default value>)``\n\nTry to check the file **config/database.php**, and find the ``env('DB_HOST', 'localhost')``, if there will be no value in our source, it will be based on the default value which is ``localhost``\n\n\n**Note:**\nThis file is already ignored under your [***GIT Distributed Version Control***](https://git-scm.com/)\n\n<a name=\"web-server\"></a>\n# Web Server\n\nSlayer has configurations for Apache2 and NginX, it is located at:\n- project-name/storage/etc/nginx/sites-available/\n- project-name/storage/etc/apache2/sites-available/\n\nwe have an example **slayer.app** file for both web server, you could copy the file and put it in your web server **sites-available** or you could apply a Symlink.\n\nLet us say we have an NginX under UbuntuOS:\n```shell\ncd /etc/nginx/sites-enabled/\nln -s ../../../var/www/phalconslayer/slayer/storage/etc/nginx/sites-available/slayer.app\nsudo service nginx restart\n```\n\nThe command above shows that you must be located at the nginx **sites-enabled** and you must call the command ``ln -s`` to apply symlink. We've also restarted the nginx server.\n\nAdd a domain on your ``/etc/hosts`` file and point it to your local IP, you should be able now to access your website.\n\nTo check that, you can try this cURL command:\n```shell\ncurl -v -s slayer.app 1> /dev/null\n```\n\nThe curl command above must return this kind of format:\n```shell\n* Connected to slayer.app (192.168.10.10) port 80 (#0)\n> GET / HTTP/1.1\n> User-Agent: curl/7.35.0\n> Host: slayer.app\n> Accept: */*\n>\n< HTTP/1.1 200 OK\n* Server nginx/1.8.0 is not blacklisted\n< Server: nginx/1.8.0\n< Date: Thu, 03 Mar 2016 00:45:27 GMT\n< Content-Type: text/html; charset=UTF-8\n< Transfer-Encoding: chunked\n< Connection: keep-alive\n< Set-Cookie: slayer=ojoo6udniihctp11hcjh1hcll3; path=/\n< Expires: Thu, 19 Nov 1981 08:52:00 GMT\n< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\n< Pragma: no-cache\n```","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"56c413b7bc41330d009f25fb","createdAt":"2016-02-17T06:31:19.235Z","project":"56c111095abfe40d00be875a","version":{"version":"1.3.0","version_clean":"1.3.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["56c1110a5abfe40d00be875e","56c413a254b6030d00ec299d","56c4275048213b1700af6e33","56c42826c0c4630d004e86cb","56c4282cbc41330d009f2607","56c4284ad1f6d91700d3697e","56e271c195d1c60e00a969ee"],"_id":"56c111095abfe40d00be875d","releaseDate":"2016-02-14T23:43:05.566Z","__v":7,"createdAt":"2016-02-14T23:43:05.566Z","project":"56c111095abfe40d00be875a"},"__v":44,"category":{"sync":{"isSync":false,"url":""},"pages":["56c413b7bc41330d009f25fb","56c4273d34df460d00c2bedb"],"title":"Setup","slug":"setup","order":1,"from_sync":false,"reference":false,"_id":"56c413a254b6030d00ec299d","version":"56c111095abfe40d00be875d","__v":2,"createdAt":"2016-02-17T06:30:58.622Z","project":"56c111095abfe40d00be875a"},"parentDoc":null,"user":"56c1105874f0b417004baadc","githubsync":""}

Installation

You can learn how to install phalcon slayer, how to initially setup your environment.

# Installation You can learn how to install phalcon slayer, how to initially setup your environment. ## Index: - [Requirements](#requirements) - [Basic](#basic-requirements) - [For Queuing](#for-queuing) - [Project Creation](#project-creation) - [Dot Environment](#dot-environment) - [Web Server](#web-server) <a name="requirements"></a> # Requirements: Before installing, there are plenty of packages that we need to install first: <a name="basic-requirements"></a> ## Basic requirements: * PHP version atleast 5.5.9 * [Phalcon Extension](https://phalconphp.com/en/download) * [Composer](https://getcomposer.org/) * [cURL](https://curl.haxx.se) <a name="for-queuing"></a> ## For Queuing: * You are required to install [Beanstalkd](http://kr.github.io/beanstalkd/) Most of these packages are already installed on your favorite os box. --- <a name="project-creation"></a> # Project Creation: Using composer, you can create a new project, write this code on your terminal: ```shell composer create-project phalconslayer/slayer --prefer-dist <folder name> ``` After running this command, there should be an output, similar below: ```shell Installing phalconslayer/slayer (version) - Installing phalconslayer/slayer (version) Downloading: 100% Created project in folderName > php -r "copy('.env.example', '.env');" Loading composer repositories with package information Installing dependencies (including require-dev) ``` --- <a name="dot-environment"></a> # Dot Environment: Let us say we have a **local** / **staging** / **production** servers. The **local** comes with multiple ***developers***, however we don't want our developers to view those passwords or we call it "credentials", such as our production database, mail credentials, aws access token and many more. On your project we have the "**.env.example**", let's copy this file and name it as "**.env**". Furthermore, this file handles a global constant value, let us say we have this: ```shell DB_HOST=192.168.10.10 ``` You can access the constant value ``DB_HOST`` by using the function ``env(<constant name>, <default value>)`` Try to check the file **config/database.php**, and find the ``env('DB_HOST', 'localhost')``, if there will be no value in our source, it will be based on the default value which is ``localhost`` **Note:** This file is already ignored under your [***GIT Distributed Version Control***](https://git-scm.com/) <a name="web-server"></a> # Web Server Slayer has configurations for Apache2 and NginX, it is located at: - project-name/storage/etc/nginx/sites-available/ - project-name/storage/etc/apache2/sites-available/ we have an example **slayer.app** file for both web server, you could copy the file and put it in your web server **sites-available** or you could apply a Symlink. Let us say we have an NginX under UbuntuOS: ```shell cd /etc/nginx/sites-enabled/ ln -s ../../../var/www/phalconslayer/slayer/storage/etc/nginx/sites-available/slayer.app sudo service nginx restart ``` The command above shows that you must be located at the nginx **sites-enabled** and you must call the command ``ln -s`` to apply symlink. We've also restarted the nginx server. Add a domain on your ``/etc/hosts`` file and point it to your local IP, you should be able now to access your website. To check that, you can try this cURL command: ```shell curl -v -s slayer.app 1> /dev/null ``` The curl command above must return this kind of format: ```shell * Connected to slayer.app (192.168.10.10) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.35.0 > Host: slayer.app > Accept: */* > < HTTP/1.1 200 OK * Server nginx/1.8.0 is not blacklisted < Server: nginx/1.8.0 < Date: Thu, 03 Mar 2016 00:45:27 GMT < Content-Type: text/html; charset=UTF-8 < Transfer-Encoding: chunked < Connection: keep-alive < Set-Cookie: slayer=ojoo6udniihctp11hcjh1hcll3; path=/ < Expires: Thu, 19 Nov 1981 08:52:00 GMT < Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 < Pragma: no-cache ```