dev-development
dev-developmentCore extension of the Spoom Framework
MIT
The Requires
- php ^7.1.0
- spoom-php/composer ^1.0.0
The Development Requires
by Nagy Samu
framework core spoom
Core extension of the Spoom Framework
The framework is a single class with some constants, internal log/reporting level handling and an extension search feature. This class main function is the
library importer with autoload support. Any other feature is provided by extensions.
The framework MUST be initialized before use. So in the bootstrap file you MUST call the Framework::setup()
to initialize the framework (autoloader, default
levels and some checks). For the method you can specify a main function that runs after the initialization. The default index.php has an example for this., (*1)
The library import is accessible with the \Framework::import()
method. This method use only one parameter that MUST be the fully qualified name of the class
that needs to be imported. This method's result is true if the given class is exists after the import. The importer main purpose is to load extension's library
classes but it also supports custom namespace sources that is compatible with PSR-4. Example for extensions:, (*2)
\<Package>(\<Name>(\<Feature>)?)?(\<Namespaces>)*\<Class(Fragment)*>
, (*3)
This "defines" the following directory structure and filename:, (*4)
/extension/<package>(-<name>)(-<feature>)?)?/library/(<namespaces>/)*<class>(<fragment>)*.php, (*5)
Directory structure (including the filename) SHOULD be lowercase, and the namespaces for that MAY have ucfirst. The importer also supports the mixed lettercase structures as well (in case-sensitive environment), but not recommended. Examples:, (*6)
The \SamplE\FoO\bAr\ClassName
class can be in:
- /extension/sample/library/foo/bar/classname.php
- /extension/sample/library/foo/bar/ClassName.php
- /extension/sample/library/FoO/bAr/ClassName.php
- /custom/sample/foo/bar/classname.php
- /custom/sample/foo/bar/ClassName.php
- /custom/samplE/FoO/bAr/ClassName.php, (*7)
The fragment parts can be ignored in the file name, so you could put more class in one file. For example: Define a trait
and an interface for it may be in the same file, or custom exception classes used by only one class... etc.
This nested classes' name MUST be started with the file name that contains the class, and the remain part MUST be separated with
an uppercase letter. For example the \Sample\Foo\ClassNameException
class' files can be:, (*8)
The importer supports custom roots for namespaces. Custom root can be added with the Framework::connect()
method where you MUST specify the namespace and this
namespace's root path. For example:, (*9)
\Framework::connect('\Sample\Foo\', '/custom/location'); // after that the '\Sample\Foo\Bar\Class' will be loaded from '/custom/location/bar/class.php'
The nesting and letter case supports also applied to the custom roots. The custom root lookup is executed before the standard extension library lookup, so be careful of the namespace you connect., (*10)
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119., (*11)
This will apply to the framework and all extensions either!, (*12)
Code MUST follow the PSR-1 guide with the following modifications:, (*13)
->exception
or ->collector
property!The code MUST follow the PSR-2 guide with the following modifications and extras:, (*14)
When making a method or function call, there MUST be a space after the opening parenthesis, and there MUST be a space before the closing parenthesis, (*15)
FIXME and TODO for class or method MUST be placed after the description in the PHPDoc, (*16)
All elements in the code (variables-, classes-, methods-, comments...etc) and readme files MUST be written in English (US) language. The documentation MAY be written in other languages, but an English version of the documentation MUST exists., (*17)
Version numbers MUST follow the Semantic Versioning rules., (*18)
One commit MUST contains only one extension's changes, but one repository MAY contain more extensions. The branching model MUST follow this "rules", with a little differences:, (*19)
title
, (*20)
content
type
!:description
, (*21)
An ! after the type indicates the compatibility broker changes., (*22)
This is the commit title, (*23)
This is a longer description for the commit changes, and MUST be in one line
fix: This is one change description that was a fix
update: This is an other change description that was an update, (*24)
Core extension of the Spoom Framework
MIT
framework core spoom