Blog

How to add gitlab-ci.yml?

Create .gitlab-ci.yml file in the root folder with this code, and commit to your Bitbucket repository. Please note that the parameters given here are only for reference. You can (in fact you should) change them according to your environment.

# Select image from https://hub.docker.com/r/_/php/
image: php:7.2

services:
  - name: mysql:8.0
    alias: mysql

variables:
  MYSQL_ROOT_PASSWORD: "passwd"
  MYSQL_HOST: "mysql"
  PHP_VERSION: '7.2'

before_script:
  # Install git, required for composer
  - apt-get update -yqq
  - apt-get install git zlib1g-dev -yqq
  - curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar
  - chmod +x /usr/local/bin/phpunit

  # Install dev environment
  - docker-php-ext-install zip
  - docker-php-ext-install pdo_mysql
  - docker-php-ext-install mysqli && docker-php-ext-enable mysqli

  # Install composer
  - curl -sS https://getcomposer.org/installer | php

  # Install all project dependencies
  - php composer.phar config cache-files-dir .composercache
  - php composer.phar self-update
  - php composer.phar install --no-progress

test:app:
  script:
    - phpunit --configuration phpunit.xml
    - vendor/bin/phpcs
  # - vendor/bin/phpmd Api,App,Cli,Framework text cleancode,codesize,controversial,design,naming,unusedcode

 

How to add bitbucket-pipelines.yml?

Create bitbucket-pipelines.yml file in the root folder with this code, and commit to your Bitbucket repository. Please note that the parameters given here are only for reference. You can (in fact you should) change them according to your environment.

image: php:7.2.0

pipelines:
  default:
    - step:
        caches:
          - composer
        script:
          - apt-get update -qq && apt-get install -yqq unzip git
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install --prefer-dist --no-scripts
          - mkdir ./test-reports
          - vendor/bin/phpcs --report=junit --report-file=./test-reports/phpcs.xml
          - vendor/bin/phpunit

The Concept

The need

Popular frameworks available in the market require a lot of vocabulary to be understood and remembered. They include a counter-intuitive learning curve, which quickly gets outdated when a new version is released. They also make the script execution cycle longer, by invoking a lot of intermediary scripts which are not required for the business logic. This makes them consume more server resources. They also include nitty-gritty things which take longer time to identify.

The thought

If there is a framework/structure that could be intuitive to any php developer, who wants to utilize the architecture of HMVC, bring in the true power of PHP, SQL and HTML stack and just wants to get started with the business logic as quickly as possible, it would help lessen the burden on those human brains.

The framework

Monsoon is the framework for you, if

  • you love core PHP with HMVC Architecture
  • you love HTML in view files, not any template engines
  • you love plain SQL queries in the models, not the ORM way
  • you love automatic routing in your application, not a big list of routing rules
  • you want to cut down the execution cycle rapidly with out interference from some black box
  • you need a light-weight and secure structure, not an extra-terrestrial structure