arvici / framework
Arvici Framework
Requires
- php: >=7.0.0
- ext-mbstring: *
- doctrine/annotations: 1.4.0
- doctrine/dbal: 2.5.13
- doctrine/migrations: 1.5.0
- doctrine/orm: 2.5.14
- filp/whoops: 2.1.14
- indigophp/hash-compat: 1.1.0
- maximebf/debugbar: 1.13.1
- monolog/monolog: 1.23.0
- mustache/mustache: 2.11.1
- psr/http-message: 1.0.1
- psr/log: 1.0.2
- swiftmailer/swiftmailer: 6.0.2
- symfony/console: 3.3.16
- symfony/form: 3.3.16
- symfony/http-foundation: 3.3.16
- symfony/monolog-bridge: 3.3.16
- symfony/psr-http-message-bridge: 1.0.2
- symfony/security: 3.3.16
- symfony/validator: 3.3.16
- symfony/var-dumper: 3.3.16
- tedivm/stash: 0.14.2
- tomvlk/sweet-orm: 2.0.0-rc.1
- twig/twig: 2.4.7
Requires (Dev)
- codacy/coverage: 1.4.0
- phpunit/php-code-coverage: 5.3.0
- phpunit/phpunit: ~6.5.7
- satooshi/php-coveralls: 1.1.0
This package is not auto-updated.
Last update: 2024-11-23 19:16:34 UTC
README
Arvici Framework
Introduction
This package contains the core functionality of the Arvici Framework. Currently being in development!
Getting started
Using this package is for experts only, please follow the link bellow to get instructions on how to get started with the framework. Getting started, use composer create-project
Components
Router
You can define your routes in the Router.php configuration. Define your routes with the Router::define method.
Example:
Router::define(function(Router $router) { $router->get('/', '\App\Controller\Welcome::index'); $router->get('/session', '\App\Controller\Welcome::session'); $router->get('/json', '\App\Controller\Welcome::json'); $router->get('/exception', '\App\Controller\Welcome::exception'); });
Database
Configuration of your database is located in the Database.php.
Example:
Configuration::define('database', function() { return [ /** * The default fetch type to use. */ 'fetchType' => \Arvici\Heart\Database\Database::FETCH_ASSOC, /** * Database Connection names and configuration values. * * 'default' is used when no connection name is provided, or using SweetORM. */ 'connections' => [ 'default' => [ 'driver' => 'MySQL', 'host' => 'localhost', 'username' => 'root', 'password' => '', 'port' => 3306, 'database' => 'arvici_test' ], ] ]; });
Models/ORM
When using the ORM, check the separate documentation: https://github.com/tomvlk/sweet-orm#defining-entities
Caching
To use the Caching system, you have to define the Caching configuration or use the FileSystem by default.
Configuration file Cache.php
:
Configure::define('cache', function () { return [ /** * Enable cache. */ 'enabled' => true, /** * Set to true to enable cache even in non-production mode. */ 'forceEnabled' => true, /** * Cache Pool Configuration. */ 'pools' => [ 'default' => [ 'driver' => '\Stash\Driver\FileSystem', 'options' => [ 'path' => BASEPATH . 'cache' . DS, ] ], ], ]; });
Using the cache pools
To retrieve a pool (where you can save and get items) you have to use the Manager:
$manager = \Arvici\Component\Cache::getInstance();
In the next step you need to get the Pool. The pool is configured in your configuration file.
$pool = $manager->getPool(); // pool name = 'default' // or with a pool name: $pool = $manager->getPool('redis-cache'); // pool name = 'redis-cache'
To retrieve, save or use an item you first have to get the context. With the instance of Item you can read and manipulate the content.
Examples of usage:
$item = $pool->get('test/cachingkey'); $item->set($data); $expiration = new DateTime('2020-01-21'); $item->expiresAfter($expiration); $item->save(); $data = $item->get(); $item->isMiss(); // bool
More information
The caching library that is used is Stash. For more information on using the pools see: http://www.stashphp.com/Basics.html
License
MIT License, see LICENSE file.