Installing BowPHP
- Prerequisites
- Create a project
- π Start your project
- βοΈ Configuration
- Web Server Configuration
- Is something missing?
Prerequisitesβ
To create a new Bow application, please first make sure your computer meets the following requirements:
- PHP >= 7.1
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- XML PHP Extension
- JSON PHP Extension
If you are on Windows and use a web server such as Laragon, these dependencies are already satisfied.
Create a projectβ
BowPHP uses Composer to manage its dependencies. So, before using Bow, you first need to install Composer on your machine.
Via Composerβ
composer create-project --prefer-dist bowphp/app nom-du-projet
We recommend installing
composerglobally on your machine. To do so, refer to Composer's installation documentation. If you are not familiar withcomposer, we encourage you to browse the documentation.
π Start your projectβ
Go to the root of your project and start the server:
cd mon-projet
php bow run:server --port=8000 --host=0.0.0.0
Open your browser and type http://localhost:8000.
5000is the default port when no port is specified with thephp bow run:servercommand.
βοΈ Configurationβ
Public Folderβ
After installing BowPHP, you must configure your server's document root to point to the public folder.
The index.php file located in the public folder serves as the entry point for all HTTP requests (it is the Front Controller).
Configuration filesβ
All of BowPHP's configuration files are stored in the config folder. Every option is documented to help you become familiar with the available options.
Folder permissionsβ
After installing Bow, you will need to configure a few permissions. The folders contained in the var folder must have write permissions on the web server.
Web Server Configurationβ
Apacheβ
Bow includes a public/.htaccess file that is used to perform URL rewriting on the front controller. Before using Bow with Apache, make sure the mod_rewrite module is enabled so that the server
takes into account the instructions in the .htaccess file.
If the default .htaccess file in Bow does not work with your Apache installation, try this alternative:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Nginxβ
If you use Nginx, the following directives in your configuration will redirect requests to the front controller:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Deploying on a shared serverβ
To deploy BowPHP on a shared server, you need to move the index.php and .htaccess files to the root of the project.
Make sure the files are correctly referenced in the index.php file, then you can copy the following code into the htaccess file.
Options -indexes
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<Files ".env.*|server.php|bow|app/**|vendor/**|postman/*|var/**|seeders/*|templates/**|tests/**|migrations/**">
Order Allow,Deny
Deny from all
</Files>
In this regard, it is recommended to reference your asset files with the
app_assetsmethod and change the value ofAPP_ASSET_PREFIXto/publicin your.env.json, and Bow does the rest π
You can continue to these sections to start your development.
- Add routes to your application
- More about controllers
- How to add data to a Database?
- Working with sessions
- Also check out the storage system
Is something missing?
If you run into problems with the documentation or have suggestions to improve the documentation or the project in general, please open an issue for us, or send a tweet mentioning the Twitter account @bowframework or directly on github.