DVC - General Purpose PSR-4 Data-View-Controller


Keywords
mvc, Model View Controller, framework, php
License
MIT

Documentation

DVC - Data View Controller

PHP framework for web applications and APIs. Configured with Bootstrap, but could just as easily support others.

Getting Started

  • WSL (Windows Subsystem for Linux) is a great development environment for PHP, there some notes about installing wsl here

Install

mkdir newapp
cd newapp

create a composer.json

The application relies on the composer autoload features, this (very) basic composer.json file tells the autloader where to look for this application and installs bravedave/dvc

composer.json

{
  "require": {
    "bravedave/dvc": "*"
  },
  "autoload": {
    "psr-4": {
      "": "src/app/"
    }
  }
}

install bravedave/dvc and update runtime autoloader

note: this is the same location used in the composer.json file

composer u

Create an basic application

create a application folder

mkdir -p src/app

add an application file

file src/app/application.php

<?php

class application extends bravedave\dvc\application {

  static public function startDir() {

    return dirname(__DIR__);
  }
}

create a documentroot

this creates a documentroot and copies in a fallback file

cp -R vendor/bravedave/dvc/tests/www src

system will run

php -S localhost:8080 src/www/_mvp.php

available at http://localhost:8080

there is a tutorial here