1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 22:56:46 +02:00

feat(core): move to Odan Session #473

This commit is contained in:
Awilum
2020-09-09 22:51:12 +03:00
parent a57e2b8b01
commit b59bb8fad4
4 changed files with 30 additions and 9 deletions

View File

@@ -28,12 +28,10 @@
"flextype-components/arrays" : "3.0.1",
"flextype-components/strings" : "1.2.0",
"flextype-components/cookie" : "1.2.0",
"flextype-components/filesystem" : "2.0.8",
"flextype-components/i18n" : "1.3.0",
"flextype-components/number" : "1.1.1",
"flextype-components/registry" : "3.0.0",
"flextype-components/session" : "1.1.1",
"slim/slim": "~3.12.3",
@@ -59,7 +57,8 @@
"thunderer/shortcode": "~0.7.4",
"composer/semver": "~3.0.1"
"composer/semver": "~3.0.1",
"odan/session": "^5.0"
},
"suggest": {
"ext-zend-opcache": "Recommended for better performance",

View File

@@ -10,7 +10,6 @@ declare(strict_types=1);
namespace Flextype;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Session\Session;
use Flextype\Foundation\Flextype;
use Slim\Http\Environment;
use Slim\Http\Uri;
@@ -30,11 +29,6 @@ use function mb_regex_encoding;
use function str_replace;
use function ucwords;
/**
* Start the session
*/
Session::start();
/**
* Init Registry
*/
@@ -109,6 +103,18 @@ if ($registry->get('flextype.settings.errors.display')) {
*/
include_once 'dependencies.php';
/**
* Set session options before you start the session
* Standard PHP session configuration options
* https://secure.php.net/manual/en/session.configuration.php
*/
flextype('session')->setOptions(flextype('registry')->get('flextype.settings.session'));
/**
* Start the session
*/
flextype('session')->start();
/**
* Include API ENDPOINTS
*/

View File

@@ -12,6 +12,7 @@ namespace Flextype;
use Bnf\Slim3Psr15\CallableResolver;
use Cocur\Slugify\Slugify;
use Flextype\Component\Strings\Strings;
use Odan\Session\PhpSession;
use Flextype\Foundation\Cors;
use Flextype\Foundation\Entries\Entries;
use Flextype\Foundation\Media\MediaFiles;
@@ -57,6 +58,13 @@ use function extension_loaded;
use function in_array;
use function sys_get_temp_dir;
/**
* Create a standard session hanndler
*/
flextype()->container()['session'] = static function () {
return new PhpSession();
};
/**
* Supply a custom callable resolver, which resolves PSR-15 middlewares.
*/

View File

@@ -398,6 +398,14 @@ media:
max_image_width: null
max_image_height: null
# Session
#
# Set session options before you start the session
# Standard PHP session configuration options
# https://secure.php.net/manual/en/session.configuration.php
session:
name: Flextype
# Content APIs
api:
entries: