etten/sandbox

The sandbox is a pre-packaged Nette Framework project, basic configured structure for your application.

Maintainers

Details

gitlab.com/etten/sandbox

Source

Issues

Installs: 32

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Language:CSS

v3.1.5 2018-03-10 14:20 UTC

README

Based on official nette/sandbox.

Sandbox is a pre-packaged and pre-configured Nette Framework application that you can use as the skeleton for your new applications.

Nette is a popular tool for PHP web development. It is designed to be the most usable and friendliest as possible. It focuses on security and performance and is definitely one of the safest PHP frameworks.

Requirements

Installing

The best way to install Sandbox is using Composer.

When you have Composer installed, run these commands and follow instructions:

composer create-project etten/sandbox my-app
cd my-app
php install.php

Run grunt-contrib-watch tasks (for automatic LESS, TypeScript compiling):

grunt watch

This can be done automatically by IDE - WebStorm, PHPStorm, see guide.

Create/update database schema:

php web/index.php orm:schema-tool:update

Create a User (username and password):

php web/index.php user:create

Navigate your browser to the www directory and you will see a welcome page. PHP 5.4 allows you run php -S localhost:8888 -t www to start the web server and then visit http://localhost:8888 in your browser.

You can log-in as created user via http://localhost:8888/admin/sign/in.

Security warning

It is CRITICAL that all files and directories except www are NOT accessible directly via a web browser! Necessary file for Apache is included (.htaccess).

Make sure that is handled properly by your server!

Included packages

Study them for deeper understanding.

CLI usage

Application has built-in CLI support.

It's realized via Kdyby\Console (Nette Extension of Symfony\Console).

For list of each commands and options just run CLI:

php web/index.php -h

Via CLI you can for example:

  • clean application caches (including Nette\DI and Latte)
  • work with Doctrine DBAL and ORM
  • run migrations
  • deploy application (it should be launched by CI/CD service)

If you use PhpStorm IDE, you can operate with its built-in CLI tool.

It's very simple and you get autocomplete suggestions for all commands and their options!

Just go to Settings - Tools - Command Line Tool Support, add new Tool Based on Symfony Console and select path to web/index.php of the application. You don't need remember all the commands now.

For more information see Symfony2 Command Line Tool Integration, Command Line Tools Based on Symfony Console (Doctrine, Laravel) in PhpStorm.

Docker

You can use included Docker environment.

Just adjust docker-compose.yml according your needs.

Then run docker-compose up. You'll reach the application via http://localhost:8080/.

If you want to run some PHP commands, login into PHP container as a non-root user:

# Login into Docker PHP terminal as a non-root user
docker exec -it -u me $(basename `pwd`)_php_1 bash