dev-master
9999999-devDefines the interfaces and traits for the services used throughout SPF
MIT
The Requires
- php ~7.2
by Simon Downes
framework php spf
Defines the interfaces and traits for the services used throughout SPF
This package defines the interfaces and traits for the core services used
throughout SPF. e.g. spf\contracts\database\DatabaseConnection
defines the contract for accessing a database, while the
spf\contracts\support\collections\Dictionary
defines methods for operating on
a collection of key/value pairs., (*1)
Each directory corresponds to a SPF package that provides implementations of
the interfaces defined in that directory. For example, the simon-downes/spf
package contains implementions of spf\contracts\log\Logger
., (*2)
Interfaces in this package are named in one of two ways:, (*3)
Dictionary
, DatabaseConnection
, Filter
)Arrayable
, Runnable
)The implementations of those interfaces within SPF packages are prefixed with Base
., (*4)
Dictionary
➡ BaseDictionary
DatabaseConnection
➡ BaseConnection
ConnectionManager
➡ BaseConnectionManager
Profiler
➡ BaseProfiler
This package is based on gamernetwork/yolk-contracts. For more information on the history and relationship between Yolk and SPF please see the README of simon-downes/spf-core., (*5)
A separate contracts package provides two primary benefits:, (*6)
Having all of the framework's services neatly defined within interfaces provides succinct documentation to available features., (*7)
Rather than tracking down which methods are available within a large, complicated class, you can refer to a simpler, cleaner interface., (*8)
Wikipedia Reference, (*9)
SPF packages provide default and usually basic implementations of each contract; sometimes these might not be sufficient or quite right for a particular project., (*10)
By specifying contracts, code is no longer coupled to these specific implementations and you may easily write alternatives that better suit your project., (*11)
Likewise, you can switch between implementations without modifying any consuming code. The classic example being able to switch caching backends (e.g. Memory/Redis/Memcache) without modifying any code that uses the cache., (*12)
Defines the interfaces and traits for the services used throughout SPF
MIT
framework php spf