Getting Started

Get Monsoon

Monsoon PHP Framework can be used by download a zip file or installed through the composer.

Download .zip file directly from our Github repository. 

If you want to use the composer, you can use create-project command from the terminal to get the framework in your system.

composer create-project monsoon/framework my_project_name

Setup

You have to setup a server to run the framework. You can setup Apache, Nginx, or any other web server, by creating a virtual host and point the document root to public/ folder.

Instead of an external web server, you can also use PHP’s internal webserver. For this, give these commands in the terminal. The framework will then be available at http://localhost:8080.

php -S localhost:8080 -t public/

The framework can be run as a docker container. Dockerfile is available under data/docker/ folder. You can make adjustments as required. Docker container binds to port 8080, so the framework will be available at http://localhost:8080.

docker-compose up -d 

Now, have a look at folder structure to get an idea of what Monsoon is about.

Folder Structure

Monsoon PHP framework contains the following folder structure.

src/Config/          << Configurations folder
 |- .env.php    << Environment specific configurations
|- .env.php.dist << Distributable environment config file
 |- .routes.php << Custom routes
|- Config.php << Config class which has generic configurations

src/App/             << All your application code resides here
|- Classes/ << Custom classes, which are not Helper classes
|- Controllers/ << Controllers of your application
|- Entities/ << Entity classes
|- Factories/ << Factory classes
|- Helpers/ << Helper classes
|- Interfaces/ << Interfaces used in your application
|- Layouts/ << Themes used in your application
|- Models/ << Model classes in your application
|- Modules/ << Modules within your application
|- [ModuleName]
|- Controllers/
|- Models/
|- views/
|- Tests/ << Unit tests for your application
|- Traits/ << Traits used in your application
|- views/ << view files in .phtml format

src/Api/ << Your API code goes in here
|- Services/ << Services in your API code
|- Tests/ << Unit tests for your API

src/Cli/ << Classes for CLI usage
Framework/ << Core classes
bin/ << shell scripts that trigger CLI classes

data/
|- cache/ << Cache folder for your implementation
|- conf/ << Custom configuration files
|- docker/ << Docker configurations
|- locale/ << Locale files for i18n
|- logs/ << Folder to store log files
|- migrations/ << Database migration files
|- schema/ << Folder to store .sqlite files
|- storage/ << Folder to store miscellaneous files
|- uploads/ << Folder to store uploaded files

resources/ << Resources to be compiled and copied into
|- css/ public/ folder, for front-end usage
|- fonts/
|- img/
|- js/
|- less/

public/
|- css/ << CSS files
|- img/ << Images
|- js/ << Javascript files used in your application
|- files/ << Files for public access
|- index.php << Entry point into the application

Remember

  • Api, App, Cli, Framework folder names have the first letter in uppercase, as they contain classes and need to be PSR-4 compliant
  • views, bin, data, resources, public folders are in lower case

Next steps

Start writing your code right away. If you want to examples or references, look at  how-to articles or see documentation.