2017 © Pedro Peláez
 

library vertex

A simple PHP framework

image

daniel-griffiths/vertex

A simple PHP framework

  • Monday, June 25, 2018
  • by Daniel-Griffiths
  • Repository
  • 3 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Vertex

A simple PHP framework inspired by Laravel, (*1)

GitHub Actions Scrutinizer Code Quality, (*2)

Requirements

Vertex makes use of Composer to autoload its dependencies. Be sure to run the following command after downloading the framework., (*3)

composer install

Then you can run the following command to start the built-in PHP server., (*4)

php -S localhost:8000 -t public

Configuration

All configuration options are specified in the .env file in the root directory. By default you will get an example file to get you started., (*5)

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=databasename
DB_USERNAME=root
DB_PASSWORD=root

There is also the option of manually declaring your setting in the /config directory. Simply go into any of the files in this directory and manually replace the getenv() functions with your desired configuration., (*6)

You can easily access any of your config options in Vertex by using the Config::get() method. Supply a string to the method (eg Config::get('database')) and it will return an array of all the values specified in that file, in this case it would be /config/database.php., (*7)

Routes

Vertex uses FastRoute for all its routing needs. Routes are stored in the app/routes.php file. Please visit the following repo for full documentation https://github.com/nikic/FastRoute., (*8)

Here are some example routes:, (*9)

/* standard routes */
$route->get('/test', 'ControllerName@MethodName');
$route->post('/test', 'ControllerName@MethodName');
$route->put('/test', 'ControllerName@MethodName');
$route->delete('/test', 'ControllerName@MethodName');

/* route with parameters */
$route->get('/test/{parameter}', 'ControllerName@MethodName');

/* route with closure */
$route->get('/test', function(){
  return 'Test!';
});

/* route group */
$route->addGroup('/admin', function ($route) {
    $route->get('/dashboard', 'AdminController@dashboard'); // admin/dashboard
    $route->get('/pages', 'AdminController@pages');         // admin/pages
    $route->get('/posts', 'AdminController@posts');         // admin/posts
});

Templating

Vertex uses Laravels fantastic Blade templating engine. Views are stored in the app/resources/views/ directory and must have the file extension of .blade.php. Please visit https://laravel.com/docs/5.3/blade for full documentation., (*10)

Here is an example blade template:, (*11)

<html>
    <head>
        <title>App Name - @yield('title')</title>
    </head>
    <body>
        @section('sidebar')
            This is the master sidebar.
        @show

        <div class="container">
            @yield('content')
        </div>
    </body>
</html>

The Versions

25/06 2018
15/12 2017

dev-add-license-1

dev-add-license-1

A simple PHP framework

  Sources   Download

MIT

The Requires

 

framework php