Modern Open Source Flat Files Content Management System.
rest-api Added new Query API 587.
entries Added new private fields functionality for entries 585.
_
and evailable only in the current entry.entry.md
---
title: Product item
_message: Message...
_vars:
currency: "USD"
vat: "@type[int] [[ strings().random(2, 1234567890) ]]"
price: "[[ 100 + _vars.vat ]]"
price_with_currency: "[[ price ~ ' ' ~ _vars.currency ]]"
---
[[ title ]] // Product item
[[ _message ]] // Message...
response
{
"title": "Product item",
"price": "120",
"price_with_currency": "120 USD"
"content": "Product item \n Message..."
}
vars Added new Vars
service to store global variables.
directives Added ability to disable expressions using !expressions
.
directives Added ability to disable shortcodes using !shortcodes
.
directives Added ability to disable markdown using !markdown
.
directives Added ability to disable textile using !textile
.
directives Added ability to disable php using !php
.
directives Added ability to disable types using !types
.
expressions Expressions language as a part of Parsers 586.
opening_variable_tag: "[["
closing_variable_tag: "]]"
opening_block_tag: "[%"
closing_block_tag: "%]"
opening_comment_tag: "[#"
closing_comment_tag: "#]"
[[
field1 ~
field2 ~
field2
]]
[[ field_name ]]
expressions Added new expression function when
.
expressions Added new expression function unless
.
expressions Added new expression function time
.
expressions Added new expression function strtotime
.
expressions Added new expression function round
.
expressions Added new expression function abs
.
expressions Added support for Vars
service. 583
vars()
returns instance of Vars
service.var()
for quick access to variables stored in Vars
service.shortcodes Added support for Vars
service. 583
(var)
to get, set, unset and delete variables from Vars
service.core Added new package Guzzle
.
core Added a new fetch
helper, expression function and shortcode with the ability to fetch data from different sources, entries, files, and URLs. 581
expressions Fixed strings
expression function.
expressions Fixed Entries
Expressions methods.
helpers Fixed issue in collection
helper with limit and offset double check.
expressions Configuration for expressions moved from entries to parsers section.
expressions Use parsers()->expressions()
instead of expressions()
to access methods.
entries Local vars
are replaced with global variables and local private fields.
shortcodes Use registerShortcodes()
instead of initShortcodes()
to register custom shortcodes.
directives Use registerDirectives()
instead of initDirectives()
to register custom directives.
exressions Use registerExpressions()
instead of initExpressions()
to register custom expressions.
core Minimum PHP version required PHP 8.1.0.
core Core application updated from Slim 3 to Slim 4!
See: Upgrade Guide
core New PHP-DI added instead of Pimple DI.
See: Usage Guide
console Added Extendable Flextype CLI Application.
Flextype CLI Application 1.0.0-alpha.1
Usage:
command [options] [arguments]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
about Get information about Flextype.
completion Dump the shell completion script
help Display help for a command
list List commands
cache
cache:clear Clear cache.
cache:clear-config Clear cache config.
cache:clear-data Clear cache data.
cache:clear-routes Clear cache routes.
cache:delete Delete item.
cache:delete-multiple Delete mutiple items.
cache:get Get item.
cache:get-multiple Get multiple items.
cache:has Check whether cache item exists.
cache:set Set item.
cache:set-multiple Set multiple items.
entries
entries:copy Copy entry.
entries:create Create entry.
entries:delete Delete entry.
entries:fetch Fetch entry.
entries:has Check whether entry exists.
entries:move Move entry.
entries:update Update entry.
tokens
tokens:create Create a new unique token.
tokens:delete Delete token entry.
tokens:fetch Fetch token entry.
tokens:generate Generate token.
tokens:generate-hash Generate token hash.
tokens:has Check whether token entry exists.
tokens:update Update tokens entry.
tokens:verify-hash Verify token hash.
core Added Thermage
library for better Flextype CLI Application styling.
core Added ability to execute specific project related code.
before-plugins
to bootstrap file before plugins intialization.after-plugins
to bootstrap file after plugins intialization.core Added new core constants: FLEXTYPE_PROJECT_NAME
, FLEXTYPE_PATH_PROJECT
, FLEXTYPE_PATH_TMP
, FLEXTYPE_START_TIME
.
core Added ability to run Flextype in silent mode by disabling app
and cli
.
core Added New Glowy PHP Packages View
, Macroable
, Strings
, Arrays
, Csrf
, Filesystem
, Registry
, Session
.
core Added built-in I18n module.
core Added ability to override default constants
entries Added new functionality that allows implementing Virtual Entries by overriding default entries CRUD methods with the help of events.
entries Added ability to create completely customisable high-level collections for entries with their fields and various formats.
entries Added ability to set custom events for each entries collections.
entries Added ability to create and use entries fields directives.
See: Documentation
entries Added ability to create custom entries macros.
Built-in macros: entries
, php
, registry
.
entries Added new method registry
to get entries registry.
entries Added new method options
to get entries options.
entries Added new method setOptions
to set entries options.
entries Added new method setRegistry
to set entries registry.
entries Added ability to override logic for built-in custom fields.
Example:
If you want to have your custom logic for processing field uuid
just update flextype project settings.
from:
...
entries:
default:
...
fields:
...
uuid:
enabled: true
path: "src/flextype/core/Entries/Fields/Default/UuidField.php"
...
...
...
...
to:
...
entries:
default:
...
fields:
...
uuid:
enabled: true
path: "project/plugins/your-custom-plugin/Entries/Fields/Default/UuidField.php"
...
...
...
...
directives Added new directive @type
to set field type.
directives Added new directive @markdown
to parse markdown text inside current field.
directives Added new directive @shortcodes
to parse shortcodes text inside current field.
directives Added new directive @textile
to parse textile text inside current field.
directives Added new directive @php
to execute php code text inside current field.
directives Added new directive [[ ]]
to eval expression.
endpoints All Rest API Endpoints codebase was rewritten from scratch.
endpoints Added new Rest API Endpoint POST /api/v1/cache/clear
to clear cache.
endpoints Added new Rest API Endpoint POST /api/v1/tokens/generate
to generate token hash.
endpoints Added new Rest API Endpoint POST /api/v1/tokens/verify-hash
to verify token hash.
endpoints Added new Rest API Endpoint POST /api/v1/tokens
to create token entry.
endpoints Added new Rest API Endpoint PATCH /api/v1/tokens
to update token entry.
endpoints Added new Rest API Endpoint DELETE /api/v1/tokens
to delete token entry.
endpoints Added new Rest API Endpoint GET /api/v1/tokens
to fetch token entry.
csrf Added Glowy CSRF protection for Cross Site Request Forgery protection by comparing provided token with session token to ensure request validity.
frontmatter Added ability to define custom frontmatter header parsers for entries. Example: instead of first ---
you may set serializer ---json
, ---json5
---yaml
or ---neon
.
serializers Added new serializer Json5
.
See: Documentation
serializers Added new serializer Neon
.
See: Documentation
serializers Added ability to set global settings for all built-in serializers.
src/flextype/settings.yaml
serializers:
json:
decode:
cache:
enabled: true
string: ""
assoc: true
depth: 512
flags: 0
encode:
options: 0
depth: 512
json5:
decode:
cache:
enabled: true
string: ""
assoc: true
depth: 512
flags: 0
encode:
options: 0
depth: 512
yaml:
decode:
cache:
enabled: true
string: ""
native: true
flags: 0
encode:
inline: 10
indent: 2
flags: 0
frontmatter:
decode:
cache:
enabled: true
string: ""
cache_id_string: ""
header:
serializer: yaml
allowed: ['yaml', 'json', 'json5', 'neon']
encode:
header:
serializer: yaml
allowed: ['yaml', 'json', 'json5', 'neon']
neon:
decode:
cache:
enabled: true
string: ""
encode:
blockMode: false
indentation: "\t"
phparray:
decode:
cache:
enabled: true
string: ""
encode:
wrap: true
serializers Added ability to set specific header serializer for Frontmatter
serializer (default is YAML).
src/flextype/settings.yaml
frontmatter:
decode:
cache:
enabled: true
string: ""
cache_id_string: ""
header:
serializer: yaml
allowed: ['yaml', 'json', 'json5', 'neon']
encode:
header:
serializer: yaml
allowed: ['yaml', 'json', 'json5', 'neon']
parsers Markdown parser Commonmark updated to v2
parsers Added new Textile parser.
parsers Added ability to set global settings for all parsers.
src/flextype/settings.yaml
parsers:
markdown:
cache:
enabled: true
string: ""
commonmark:
renderer:
block_separator: "\n"
inner_separator: "\n"
soft_break: "\n"
commonmark:
enable_em: true
enable_strong: true
use_asterisk: true
use_underscore: true
unordered_list_markers: ['-', '*', '+']
html_input: 'allow'
allow_unsafe_links: false
max_nesting_level: 9223372036854775807
slug_normalizer:
max_length: 255
textile:
cache:
enabled: true
string: ""
restricted: false
document_type: 'xhtml'
document_root_directory: ''
lite: false
images: true
link_relation_ship: ''
raw_blocks: false
block_tags: true
line_wrap: true
image_prefix: ''
link_prefix: ''
symbol: []
dimensionless_images: true
shortcodes:
cache:
enabled: true
string: ""
cache_id_string: ""
opening_tag: "("
closing_tag: ")"
closing_tag_marker: "/"
parameter_value_separator: ":"
parameter_value_delimiter: "'"
shortcodes:
entries:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/EntriesShortcode.php"
fetch:
enabled: true
php:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/PhpShortcode.php"
raw:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/RawShortcode.php"
textile:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/TextileShortcode.php"
markdown:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/MarkdownShortcode.php"
registry:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/RegistryShortcode.php"
get:
enabled: true
url:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/UrlShortcode.php"
strings:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/StringsShortcode.php"
filesystem:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/FilesystemShortcode.php"
get:
enabled: true
i18n:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/I18nShortcode.php"
if:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/IfShortcode.php"
when:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/WhenShortcode.php"
unless:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/UnlessShortcode.php"
uuid:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/UuidShortcode.php"
const:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/ConstShortcode.php"
var:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/VarShortcode.php"
field:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/FieldShortcode.php"
calc:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/CalcShortcode.php"
eval:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/EvalShortcode.php"
type:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/TypeShortcode.php"
parsers Added ability to override logic for built-in shortcodes.
Example:
If you want to have your custom logic for processing shortcode url
just update flextype settings.
from:
...
parsers:
shortcodes:
shortcodes:
...
url:
enabled: true
path: "src/flextype/core/Parsers/Shortcodes/UrlShortcode.php"
...
...
...
...
to:
...
parsers:
shortcodes:
shortcodes:
...
url:
enabled: true
path: "project/plugins/your-custom-plugin/Parsers/Shortcodes/UrlShortcode.php"
...
...
...
...
routes Added ability to set custom projects routes in /projects/routes/routes.php
.
shortcodes Added new shortcode (entries)
to fetch entry (or entries collection) or specific field.
shortcodes Added new shortcode (registry)
to fetch data from registry.
shortcodes Added new shortcode (filesystem)
to work with filesystem.
shortcodes Added new shortcode (uuid)
to generate uuid.
shortcodes Added new shortcode (strings)
for strings manipulation.
shortcodes Added new shortcode (textile)
to parse textile text.
shortcodes Added new shortcode (php)
to execute php code.
shortcodes Added new shortcode (eval)
to eval expression.
shortcodes Added new shortcode (calc)
to calculate values.
shortcodes Added new shortcode (type)
to set field type.
shortcodes Added new shortcode (markdown)
to parse markdown text.
shortcodes Added new shortcode (getProjectUrl)
to get project url.
shortcodes Added new shortcode (getBaseUrl)
to get base url.
shortcodes Added new shortcode (getBasePath)
to get base path.
shortcodes Added new shortcode (getAbsoluteUrl)
to get absolute url.
shortcodes Added new shortcode (url)
to get url.
shortcodes Added new shortcode (urlFor)
to get url for route.
shortcodes Added new shortcode (getUriString)
to get uri string.
shortcodes Added new shortcode (filesystem)
to do filesytem manipulations.
shortcodes Added new shortcode (date)
to get date.
shortcodes Added new shortcode (tr)
to returns translation of a string.
shortcodes Added new shortcode (if)
to use logical if conditions.
shortcodes Added new shortcode (when)
to use logical positive if conditions.
shortcodes Added new shortcode (unless)
to use logical negative if conditions.
shortcodes Added new shortcode (var)
to get and set entry variables values.
shortcodes Added new shortcode (field)
to get entry fields values.
shortcodes Added new shortcode (const)
to get defined costants.
shortcodes Added new shortcode (raw)
to ignore shortcodes processing.
expressions Added a new configurable and extendable expressions engine with a collection of predefined expressions.
expressions Added new expression function actions
to get actions service.
expressions Added new expression function collection
to create a new arrayable collection object from the given elements.
expressions Added new expression function collectionFromJson
to create a new arrayable collection object from the given JSON string.
expressions Added new expression function collectionFromString
to create a new arrayable collection object from the given string.
expressions Added new expression function collectionWithRange
to create a new arrayable object with a range of elements.
expressions Added new expression function collectionFromQueryString
to create a new arrayable object from the given query string.
expressions Added new expression function filterCollection
to filter collection.
expressions Added new expression function const
to get defined constants.
expressions Added new expression function var
to get current entry var.
expressions Added new expression function field
to get current entry field.
expressions Added new expression function csrf
to get csrf hidden input.
expressions Added new expression function entries
to get entries service.
expressions Added new expression function filesystem
to get filesystem instance.
expressions Added new expression function strings
to get strings instance.
expressions Added new expression function tr
to return translation of a string. If no translation exists, the original string will be returned.
expressions Added new expression function __
to return translation of a string. If no translation exists, the original string will be returned.
expressions Added new expression function max
to return the highest value in an array, or the highest value of several specified values.
expressions Added new expression function min
to return the lowest value in an array, or the lowest value of several specified values.
expressions Added new expression function ceil
to round a number up to the nearest integer.
expressions Added new expression function floor
to round a number down to the nearest integer.
expressions Added new expression function parsers
to get parsers service.
expressions Added new expression function serializers
to get serializers service.
expressions Added new expression function registry
to get registry service.
expressions Added new expression function slugify
to get slugify service.
expressions Added new expression function date
to get date.
expressions Added new expression function url
to get the url.
expressions Added new expression function urlFor
to get the url for a named route.
expressions Added new expression function fullUrlFor
to get the full url for a named route.
expressions Added new expression function isCurrentUrl
to determine is current url equal to route name.
expressions Added new expression function getCurrentUrl
to get current path on given Uri.
expressions Added new expression function getBasePath
to get the base path.
expressions Added new expression function getBaseUrl
to get the base url.
expressions Added new expression function getAbsoluteUrl
to get the absolute url.
expressions Added new expression function getProjectUrl
to get the project url.
expressions Added new expression function getUriString
to get the uri string.
expressions Added new expression function redirect
to create redirect.
cache Added new cache driver Phparray
to store cache data in raw php arrays files.
cache Added router cache.
cache Added ability to set custom cache ID string for entries
, parsers
and serializers
.
tokens Added new Tokens API.
helpers All core helpers are located in the src/flextype/helpers/
.
helpers Added helper function app
to get Flextype Application instance.
helpers Added helper function container
to get Flextype Application Container instance.
helpers Added helper function emitter
to get Flextype Emitter Service.
helpers Added helper function cache
to get Flextype Cache Service.
helpers Added helper function entries
to get Flextype Entries Service.
helpers Added helper function parsers
to get Flextype Parsers Service.
helpers Added helper function serializers
to get Flextype Serializers Service.
helpers Added helper function logger
to get Flextype Logger Service.
helpers Added helper function session
to get Flextype Session Service.
helpers Added helper function csrf
to get Flextype CSRF Service.
helpers Added helper function plugins
to get Flextype Plugins Service.
helpers Added helper function console
to get Flextype Console Service.
helpers Added helper function imageFile
to create a new image instance for image file.
helpers Added helper function imageCanvas
to create a new image canvas instance.
helpers Added helper function generateToken
to generate unique token.
helpers Added helper function generateTokenHash
to generate unique token hash.
helpers Added helper function verifyTokenHash
to validate token hash.
helpers Added helper function url
to get url.
helpers Added helper function urlFor
to get url for a named route.
helpers Added helper function fullUrlFor
to get full url for a named route.
helpers Added helper function isCurrentUrl
to determine is current url equal to route name.
helpers Added helper function getCurrentUrl
to get current path on given Uri.
helpers Added helper function getBasePath
to get base path.
helpers Added helper function setBasePath
to set base path.
helpers Added helper function redirect
to create redirect.
helpers Added helper function upload
to upload files and process uloaded images.
uploder Added Configurable Sirius Uploader for file upload.
# Upload
upload:
# Uploads directory
directory: '/uploads'
# Overwrite existing files.
overwrite: true
# Auto-confirm uploads.
autoconfirm: false
# Prefixing uploads.
prefix: ''
# Validation options
validation:
# Allowed file extensions.
allowed_file_extensions: ['gif', 'jpg', 'jpeg', 'png', 'ico', 'webm', 'svg']
# Maximum file size.
max_file_size: '24M'
# Image validation options
image:
# Image maxiumum and minimum width
width:
max: 4920
min: 100
# Image maxiumum and minimum height
height:
max: 3264
min: 100
# Image ratio
#ratio:
# The option can be a number (eg: 1.3) or a ratio-like string (eg: 4:3, 16:9).
# size: 1.3
# The option error_margin specifies how much the image is allowed to
# deviate from the target ratio. Default value is 0.
# error_margin: 0
# Process uploaded files
process:
# Images process settings
image:
# Image quality
quality: 70
macros All core macros are located in the src/flextype/macros/
.
macros Added onlyFromCollection
and exceptFromCollection
macros for Arrays (#553)
actions Added new Actions API (#549)
// Set new action entries.create
actions()->set('entries.create', function($id, $data) {
return entries()->create($id, $data);
});
// Get action entries.create
actions()->get('entries.create')('hello-world', []);
// Set new action entries.update
actions()->set('entries.update', function($id, $data) {
if (entries()->update($id, $data)) {
logger()->info("Content {$id} successfully updated");
cache()->delete($id);
} else {
logger()->error("Content {$id} was not updated");
}
});
// Get action entries.update
actions()->get('entries.update')('hello-world', []);
// Set new action entries.create
actions()->set('entries.create', function($id, $data) {
if(registry()->get('database') == 'MySQL') {
// ... create new entry in the MySQL database.
} else {
return entries()->create($id, $data);
}
});
// Get action entries.create
actions()->get('entries.create')('blog/post-1', []);
actions()->get('entries.create')('blog/post-2', []);
actions()->get('entries.create')('blog/post-3', []);
The Flextype Actions API provides new capabilities to extend the Flextype core by registering and reusing useful code snippets from global actions namespace.
parsers Fixed issue with double cashing.
htaccess Security fixes for .htaccess
entries Fixed issue when entries collection fetch returns empty result.
plugins Fixed Plugins API translation loading process.
plugins Fixed Plugins API initialization (#551)
plugins Fixed Plugins API dependency initialization.
plugins Fixed Plugins API issue with non valid plugins (#551)
plugins Fixed Plugins API loader issue with disabled plugins.
media Media and Glide functionality removed from the flextype core due to security and perfomance reasons. Recomended to use imagekit or imgix instead.
core Use new constant FLEXTYPE_PATH_PROJECT
instead of PATH['project']
and FLEXTYPE_PATH_TMP
instead of PATH['tmp']
.
shortcodes New default shortcodes syntax and signatures changes for all shortocodes.
opening_tag: "("
closing_tag: ")"
closing_tag_marker: "/"
parameter_value_separator: ":"
parameter_value_delimiter: '"'
helpers Use new helpers functions to access Flextype Services.
entries()
instead of flextype('entries')
session()
instead of flextype('session')
cache()
instead of flextype('cache')
app()
instead of flextype()
container()
instead of flextype('container_name_here')
parsers()
instead of flextype('parsers')
serializers()
instead of flextype('serializers')
plugins()
instead of flextype('plugins')
emitter()
instead of flextype('emitter')
logger()
instead of flextype('logger')
registry()
instead of flextype('registry')
helpers Use helper function app
to access Flextype Application instance instead of old helper function flextype()
.
helpers Use helper function container
to access Flextype Application container instead of old helper function flextype()
with container name argument.
container()->get('entries')
instead of flextype('entries')
container()->set('entries', new Entries())
instead of flextype()['entries'] = new Entries()
helpers Use helper function filterCollection
instead of old filter
.
tokens Project tokens moved from project/tokens
to project/entries/tokens
.
entries Changes for etnries memory storage.
entries()->registry()->get()
instead of flextype('entries')->storage()->get()
entries()->registry()->set()
instead of flextype('entries')->storage()->set()
entries()->registry()->has()
instead of flextype('entries')->storage()->has()
entries()->registry()->delete()
instead of flextype('entries')->storage()->delete()
note: all method from Glowy PHP Arrays are available for Arrays Storage Object manipulations docs: https://github.com/glowyphp/arrays
core General code refactoring and improvements.
tests All unit tests were rewritten.
parsers add commonmark instead of parsedown (#540)
shortcodes add new shortcode - media_files_fetch
example:
[media_files_fetch id="entries/home/foo.txt" field="title" default="Bar"]
src/
vendor/
var/
index.php
src/
vendor/
index.php
has()
for Media Folders (#534)entries according to this ticket (#536) we have several changes for entries storage.
flextype('entries')->storage()->get()
instead of flextype('entries')->getStorage()
flextype('entries')->storage()->set()
instead of flextype('entries')->setStorage()
flextype('entries')->storage()->has()
instead of flextype('entries')->hasStorage()
flextype('entries')->storage()->delete()
instead of flextype('entries')->deleteStorage()
note: all method from Atomastic Arrays are available for Arrays Storage Object manipulations docs: https://github.com/atomastic/arrays
src/
vendor/
var/
index.php
src/
vendor/
index.php
core Moving to PHP 7.4.0 (#524)
plugins Set default plugin priority 100 and SORT them ascending (#523)
core fix issue with Rest API endpoints detection. (#522)
entries fix issue with empty variable $data in fetch() method. (#531)
entries fix issue with deleteStorage() method return data.
src/
vendor/
var/
index.php
src/
vendor/
index.php
media-files we will use fetch()
method as entry point to execute different methods with fetch
prefix. (#508)
/**
* Fetch.
*
* @param string $id The path to file.
* @param array $options Options array.
*
* @access public
*
* @return self Returns instance of The Arrays class.
*/
public function fetch(string $id, array $options = []): Arrays
Media Files API is macroable and we will able to add any custom fetch methods for receiving data from different sources.
flextype('media')->files()::macro('fetchFromOtherStorage', function(string $id, array $options) {
// fetch data from Other Storage using $id and $options
});
$data = flextype('media')->files()-> fetchFromOtherStorage($id, $options);
media-folders we will use fetch()
method as entry point to execute different methods with fetch
prefix. (#509)
/**
* Fetch.
*
* @param string $id The path to folder.
* @param array $options Options array.
*
* @access public
*
* @return self Returns instance of The Arrays class.
*/
public function fetch(string $id, array $options = []): Arrays
Media Folders API is macroable and we will able to add any custom fetch methods for receiving data from different sources.
flextype('media')->folders()::macro('fetchFromOtherStorage', function(string $id, array $options) {
// fetch data from Other Storage using $id and $options
});
$data = flextype('media')->folders()-> fetchFromOtherStorage($id, $options);
entries we will use fetch()
method as entry point to execute different methods with fetch
prefix. (#495)
/**
* Fetch.
*
* @param string $id Unique identifier of the entry.
* @param array $options Options array.
*
* @access public
*
* @return mixed
*/
public function fetch(string $id, array $options = []): Arrays
Entries API is macroable and we will able to add any custom fetch methods for receiving data from different sources.
flextype('entries')::macro('fetchXML', function(string $id, array $options) {
// fetch data from XML using $id and $options
});
$data = flextype('entries')->fetchXML($id, $options);
images we will use media/
folder instead of uploads/entries/
(#516)
serializers standardise serializers container names with macroable ability. (#518)
New methods to access Serializers:
flextype('serializers')->yaml()
flextype('serializers')->json()
flextype('serializers')->frontmatter()
Adding macros:
flextype('serializers')::macro('NAME', CALLBACK_FUNCTION() {});
parsers standardise parsers container names with macroable ability. (#519)
New methods to access Parsers:
flextype('parsers')->shortcode()
flextype('parsers')->markdown()
Adding macros:
flextype('parsers')::macro('NAME', CALLBACK_FUNCTION() {});
media standardise media container names with macroable ability for Media API. (#517)
New macroable common class for all media - class Media
New methods to access Media API:
flextype('media')->files()
flextype('media')->files()->meta()
flextype('media')->folders()
flextype('media')->folders()->meta()
Adding macros:
flextype('media')::macro('NAME', CALLBACK_FUNCTION() {});
flextype('media')->files()::macro('NAME', CALLBACK_FUNCTION() {});
flextype('media')->files()->meta()::macro('NAME', CALLBACK_FUNCTION() {});
flextype('media')->folders()::macro('NAME', CALLBACK_FUNCTION() {});
flextype('media')->folders()->meta()::macro('NAME', CALLBACK_FUNCTION() {});
fields add new field registry.get
for Registry API (#494)
Registry API provides method get()
for retrieving data from registry and we should able to access them inside entries frontmatter header for retrieving data right in the entries.
Basic Example
Sample entry with several queries and with several nested queries inside of children entries.
File: /project/entries/registry-root/entry.md
---
title: Root
registry:
get:
flextype:
key: flextype.manifest.name
author.name:
key: flextype.manifest.author.name
license:
key: flextype.manifest.license
entries:
fetch:
level1:
id: registry-root/level-1
---
Setting for this fields
File: /project/config/flextype/settings.yaml
entries:
fields:
registry:
get:
enabled: true
Valid values for setting enabled is true or false
fields add new field entries.fetch
for Entries API (#492)
Entries API provides methods for entries fetch: fetch()
and we should able to access them inside entries frontmatter header for fetching data right in the entries. Also, we will able to add and use any kind of fetch methods with our macroable functionality.
Basic Example
Catalog entry with several queries and with several nested queries inside of children entries.
File: /project/entries/catalog/entry.md
---
title: Catalog
visibility: visible
entries:
fetch:
label1:
id: discounts/50-off
options:
filter:
limit: 4
bikes:
id: catalog/bikes
options:
collection: true
filter:
where:
-
key: brand
operator: eq
value: gt
limit: 10
discounts:
id: discounts
options:
collection: true
filter:
where:
-
key: title
operator: eq
value: '30% off'
-
key: category
operator: eq
value: bikes
---
Setting for this fields
File: /project/config/flextype/settings.yaml
entries:
fields:
entries:
fetch:
enabled: true
result: toObject
Valid values for setting enabled is true or false
Valid values for setting result is toObject or toArray
fields add new field media.files.fetch
and media.folders.fetch
for Media API's (#501) (#500)
Media API's provides methods for files and folders fetch: fetch()
and we should able to access them inside entries frontmatter header for fetching data right in the entries. Also, we will able to add and use any kind of fetch methods with our macroable functionality.
---
title: Media
media:
folders:
fetch:
macroable_folder:
id: 'foo'
options:
method: fetchExtraData
foo_folder:
id: 'foo'
collection_of_folders:
id: '/'
options:
collection: true
files:
fetch:
macroable_file:
id: 'foo'
options:
method: fetchExtraData
foo_file:
id: foo.txt
collection_of_files:
id: '/'
options:
collection: true
---
Setting for this fields
File: /project/config/flextype/settings.yaml
entries:
fields:
media:
files:
fetch:
enabled: true
result: toObject
folders:
fetch:
enabled: true
result: toObject
Valid values for setting enabled is true or false
Valid values for setting result is toObject or toArray
entries add new method deleteStorage()
for Entries API (#498)
entries add new method hasStorage()
for Entries API (#497)
core add new method isApiRequest
to Determine API Request in the basic core functionality. (#507)
rest-api-entries add ability to send options for fetch()
methods in Entries Rest API. (#504)
Fetch single
GET /api/entries?id=YOUR_ENTRY_ID&token=YOUR_ENTRIES_TOKEN
Fetch single with options
GET /api/entries?id=YOUR_ENTRY_ID&options=[filter]&token=YOUR_ENTRIES_TOKEN
Fetch collection
GET /api/entries?id=YOUR_ENTRY_ID&options[collection]=true&token=YOUR_ENTRIES_TOKEN
Fetch collection with options
GET /api/entries?id=YOUR_ENTRY_ID&options[collection]=true&options=[find]&[filter]&token=YOUR_ENTRIES_TOKEN
rest-api-entries add ability to call macroable fetch methods. (#505)
With help of query option ?options[method]=
we should able to call any macroable fetch methods.
Macroable method XML
flextype('entries')::macro('fetchXml', function(string $id, array $options) {
return ['XML DATA HERE'];
});
HTTP GET:
GET /api/entries?id=YOUR_ID&options[method]=fetchXml&token=YOUR_ENTRIES_TOKEN
rest-api-media reorganize endpoints for Media Rest API (#514)
rest-api-media add ability to call macroable fetch methods for Folder. (#512)
With help of query option ?options[method]=
we should able to call any macroable fetch methods.
Macroable method
flextype('media')->folders()::macro('fetchFromOtherStorage', function(string $id, array $options) {
// fetch data from Other Storage using $id and $options
});
HTTP GET:
GET /api/folders?id=YOUR_MEDIA_FILES_ID&options[method]= fetchFromOtherStorage&token=YOUR_MEDIA_FOLDERS_TOKEN
rest-api-media add ability to call macroable fetch methods for Files. (#513)
With help of query option ?option[method]=
we should able to call any macroable fetch methods.
Macroable method
flextype('media')->files()::macro('fetchFromOtherStorage', function(string $id, array $options) {
// fetch data from Other Storage using $id and $options
});
HTTP GET:
GET /api/files?id=YOUR_MEDIA_FILES_ID&option[method]=fetchFromOtherStorage&token=YOUR_MEDIA_FILES_TOKEN
fields fix issue with slug field in Entries API (#520)
core fix issue with invalid timezone setting (#490)
entries fix issue with not exists entries collections. (#503)
entries fix issue with collisions in Entries API $storage for entries fetching. (#496)
rest-api-entries fix issue with 404 status code in Entries Rest API (#502)
rest-api fix issue with Rest API endpoints initialisation. (#506)
media standardise media container names with macroable ability for Media API. (#517)
NEW CONTAINER | OLD CONTAINER |
---|---|
media | media_files, media_files_meta, media_folders, media_folders_meta |
parsers standardise parsers container names with macroable ability. (#519)
NEW CONTAINER | OLD CONTAINER |
---|---|
parsers | shortcode, markdown |
serializers standardise serializers container names with macroable ability. (#518)
NEW CONTAINER | OLD CONTAINER |
---|---|
serializers | yaml, json, frontmatter |
rest-api-media reorganize endpoints for Media Rest API (#514)
NEW ENDPOINT | OLD ENDPOINT | |
---|---|---|
GET | /api/media/files | /api/files |
POST | /api/media/files | /api/files |
PUT | /api/media/files | /api/files |
PATCH | /api/media/files | /api/files |
DELETE | /api/media/files | /api/files |
POST | /api/media/files/copy | /api/files/copy |
PATCH | /api/media/files/meta | /api/files/meta |
POST | /api/media/files/meta | /api/files/meta |
DELETE | /api/media/files/meta | /api/files/meta |
GET | /api/media/folders | /api/folders |
POST | /api/media/folders | /api/folders |
PATCH | /api/media/folders | /api/folders |
DELETE | /api/media/folders | /api/folders |
POST | /api/media/folders/copy | /api/folders/copy |
Tokens:
/tokens/files/
to /tokens/media/files/
/tokens/folders/
to /tokens/media/folders/
Settings:
api:
...
media:
files:
enabled: true
default_token:
folders:
enabled: true
default_token:
helpers filter
helper return array
result every time and not int
or bool
. (#493)
helpers filter
helper not support slice_offset
and slice_limit
because they are are duplicates already exists functionality offset
and limit
. (#493)
helpers filter
helper not support count
and exists
. (#493)
entries we have changes in the events names for Entries API (#499)
Events:
onEntriesFetch
onEntriesFetchSingle instead of onEntryInitialized
onEntriesFetchSingleCacheHasResult instead of onEntryAfterCacheInitialized
onEntriesFetchSingleNoResult
onEntriesFetchSingleHasResult instead of onEntryAfterInitialized
onEntriesFetchCollection instead of onEntriesInitialized
onEntriesFetchCollectionHasResult instead of onEntriesAfterInitialized
onEntriesFetchCollectionNoResult
onEntriesMove instead of onEntryMove
onEntriesUpdate instead of onEntryUpdate
onEntriesCreate instead of onEntryCreate
onEntriesDelete instead of onEntryDelete
onEntriesCopy instead of onEntryCopy
onEntriesHas instead of onEntryHas
entries Flextype EMS structure is changes because of issues with collisions (#496)
Updated structure:
$storage = [
'fetch' => [
'id' => '',
'data' => [],
'options' => [
'find' => [],
'filter' => [],
],
],
'create' => [
'id' => '',
'data' => [],
],
'update' => [
'id' => '',
'data' => [],
],
'delete' => [
'id' => '',
],
'copy' => [
'id' => '',
'newID' => '',
],
'move' => [
'id' => '',
'newID' => '',
],
'has' => [
'id' => '',
],
];
rest-api-entries Entries Rest API - for collection fetch we should define this in the request query &options[collection]=true
rest-api-entries Entries Rest API - instead of &filter=[]
we should define filtering in the request query like this &options[find]
and &options[filter]
rest-api-media-files Media Files Rest API - for collection fetch we should define this in the request query &options[collection]=true
rest-api-media-folders Media Folders Rest API - instead of &filter=[]
we should define filtering in the request query like this &options[find]
and &options[filter]
images we will use media/
folder instead of uploads/entries/
(#516)
uploads/entries/
should should be renamed to media/entries/
related to this ticket: #515/api/images/{path:.+}
path for entries, should starts with /entries/
.Example:
old: /api/images/home/banner.jpg
new: /api/images/entries/home/banner.jpg
entries we should use only fetch()
method as entry point to execute different methods with fetch
prefix. (#495)
fetchSingle()
removed. Use fetch($id, $options)
method.fetchCollection
removed. Use fetch($id, ['collection' => true])
method.media-folders we should use only fetch()
method as entry point to execute different methods with fetch
prefix. (#509)
fetchSingle()
removed. Use fetch($id, $options)
method.fetchCollection
removed. Use fetch($id, ['collection' => true])
method.media-files we should use only fetch()
method as entry point to execute different methods with fetch
prefix. (#508)
fetchSingle()
removed. Use fetch($id, $options)
method.fetchCollection
removed. Use fetch($id, ['collection' => true])
method.src/
vendor/
var/
index.php
src/
vendor/
index.php
core add Atomastic Components instead of Flextype Components (#478)
Added:
entries Entries API return Arrays Object instead of plain array on fetch. (#485)
From no we have ability to work with entries singles and collections as with smart objects for further data manipulations with help of Atomastic Arrays Component.
Example:
// Fetch random 10 posts created by Awilum and sort them by published_at field.
$posts = flextype('entries')
->fetchCollection('blog')
->where('author.name', 'eq', 'Awilum')
->sortBy('published_at')
->limit(10)
->random();
entries Standardize Entries API fetch. (#486)
entries Standardize Media Files API fetch. (#487)
entries Standardize Media Folders API fetch. (#488)
entries Add ability to extend Core class with Macros. (#489)
cache add new cache engine - PHPFastCache instead of Doctrine Cache (#457)
https://github.com/flextype/flextype/blob/dev/src/flextype/settings.yaml#L127-L241
We are start using PhpFastCache PSR16 adapter
https://github.com/PHPSocialNetwork/phpfastcache
core Unit Test powered by PestPHP.
media add new move()
method instead of rename()
entries add new move()
method instead of rename()
core add new PATH['tmp']
constant (#470)
Now we have:
PATH['tmp']
constant instead of PATH['cache']
and PATH['logs']
markdown add markdown basic settings (#471)
markdown:
auto_line_breaks: false
auto_url_links: false
escape_markup: false
markdown add ability to access markdown parser instance (#468)
Usage:
$markdown = flextype('markdown')->getInstance();
entries add new Flextype Entries Memory Storage (Flextype EMS). New private property $storage
for storing current requested entry(or entries) data and all Entries CRUD operations data in memory with ability to change them dynamically on fly. New public methods getStorage()
setStorage()
(#467)
Structure (Flextype EMS):
$storage = [
'fetch' => [
'id' => '',
'data' => '',
],
'create' => [
'id' => '',
'data' => '',
],
'update' => [
'id' => '',
'data' => '',
],
'delete' => [
'id' => '',
],
'copy' => [
'id' => '',
'new_id' => '',
],
'move' => [
'id' => '',
'new_id' => '',
],
'has' => [
'id' => '',
],
];
Accessing storage example:
flextype('emitter')->addListener('onEntryAfterInitialized', static function () : void {
flextype('entries')->setStorage('fetch.data.title', 'New title');
});
$entry = flextype('entries')->fetchSingle('about');
echo $entry['title'];
entries add new events: onEntryHas
, onEntryInitialized
, onEntriesInitialized
(#467)
helpers add new support helper find()
for files and directories searching instead of find_filter()
helpers add new support helper filter()
for data collection filtering instead of arrays_filter()
entries fix issue with delete()
method (#465)
media fix issue with exif_read_data()
on files upload.
entries removed properties from Entries API (#467)
$entry_id
$entry
$entry_create_data
$entry_update_data
$entries_id
$entries
Use public methods getStorage()
setStorage()
instead.
Example:
// old
flextype('entries')->entry['title'] = 'New title';
// new
flextype('entries')->setStorage('fetch.data.title', 'New title');
// old
$title = flextype('entries')->entry['title'];
// new
$title = flextype('entries')->getStorage('fetch.data.title');
$title = flextype('entries')->getStorage('fetch.data')['title'];
core Removed App from all core namespaces (#469)
We should have
use Flextype\Foundation\Entries\Entries;
instead of
use Flextype\App\Foundation\Entries\Entries;
core use new PATH['tmp']
constant instead of PATH['cache']
and PATH['logs']
(#470)
cache old cache config removed, use new config for PhpFastCache (#457)
cache use methods has()
set()
get()
instead of contains()
save()
fetch()
(#457)
core remove flextype-components/session (#473)
core remove flextype-components/cookie (#473)
core remove flextype-components/number (#474)
core remove flextype-components/filesystem (#474)
core remove flextype-components/arrays (#474)
src/
vendor/
var/
index.php
src/
vendor/
index.php
New helper function added for access all Flextype features in one place
flextype($container_name = null, $container = [])
IMPORTANT
Do not use $flextype
object to access Flextype features, use flextype()
helper function.
src/
vendor/
index.php
src/
vendor/
index.php
core Moving to PHP 7.3.0 (#456)
core add new class Flextype
that extends Slim\App
(#458)
with methods:
/**
* Get Dependency Injection Container.
*
* @param string $key DI Container key.
*/
public function container(?string $key = null)
/**
* Returns Flextype Instance
*/
public static function getInstance()
/**
* This method will returns the current Flextype version
*/
public static function getVersion() : string
collection Add only()
method for Collection (#455)
Example:
...->only(['id', 'title'])->...
entries Rename path to id in Entries API (#453)
New implementation
// Entry properties
$entry_id
$entries_id
// Arguments
$id
$new_id
shortcode add New Shortcode (#454)
[raw] Raw shortcode content [/raw]
shortcode add New Shortcode Methods (#454)
// Get shortcode instance.
getInstance()
// Add shortcode handler.
addHandler(string $name, $handler)
// Add event handler.
addEventHandler($name, $handler)
// Processes text and replaces shortcodes.
process(string $input, bool $cache = true)
purge()
method. (#451)id
(#452)entries Rename path to id in Entries API (#453)
Old Entry properties
$entry_path
$entries_path
New Entry properties
$entry_id
$entries_id
entries fix wrong Implementation of Slug Field for Entries (#452)
From now we have entry fields:
slug
with current entry slug.
Example:
flextype-0.9.10
id
with current entry full path as it is was for slug field.
Example:
blog/flextype-0.9.10
shortcode We should use process()
method instead of parse()
for shortcode processing. (#454)
Example of new usage in PHP:
...->shortcode->process($input, $cache);
core $container
, $flextype
and $app
objects removed! (#458)
We should use new object $flextype
as it is a consolidate entry point to all Flextype features.
Here is some examples:
// OLD
$app->get(...)
$app->post(...)
...
// NEW
$flextype->get(...)
$flextype->post(...)
...
// OLD
$container['registry'] = static function ($container) {
return new Registry($container);
};
$container->registry->get(...)
// NEW
$flextype->container()['registry'] = static function () use ($flextype) {
return new Registry($flextype);
};
$flextype->container('registry')->get(....)
core class Container
removed! (#458)
We should use $flextype
object to access all Flextype features inside Service Controllers and Models.
Here is some examples:
// OLD
class FooController extends Container
{
public function bar()
{
return $this->registry->get('.....');
}
}
// NEW
class FooController
{
protected $flextype;
public function __construct($flextype)
{
$this->flextype = $flextype;
}
public function bar()
{
return $this->flextype->container('registry')->get('.....');
}
}
src/
vendor/
index.php
src/
vendor/
index.php
var/
!