Presentator v2 REST API
This package is auto-updated.
Last update: 2021-04-12 14:37:28 UTC
Presentator v2 REST API server implementation, written in PHP and based on Yii2.
Detailed API reference could be found here - https://presentator.io/docs.
This repository is READ-ONLY. Report issues and send pull requests in the main Presentator repository.
Apache/Nginx HTTP server
SQL database (MySQL/MariadDB/PostgreSQL)
For MySQL up to 5.6 and MariaDB up to 10.1 you may need to set
innodb_default_row_format=dynamicto prevent migration errors (see #104).
PHP 7.1+ with the following extensions:
Reflection PCRE SPL MBString OpenSSL Intl ICU version Fileinfo DOM extensions GD or Imagick
For more detailed check, run
php requirements.phpfrom the application root directory.
In addition, here are some recommended
post_max_size = 64M upload_max_filesize = 64M max_execution_time = 60 memory_limit = 256M
Before getting started make sure that you have checked the project requirements and installed Composer.
Clone or download the repo.
For security reasons, if you are using a shared hosting service it is recommended to place the project files outside from your default public_html(www) directory!
Setup a vhost/server address (eg.
http://api.presentator.local/) and point it to
By default a generic
.htaccessfile will be created for you after initialization. If you are using nginx, you could check the following sample configuration.
Run the following commands:
# navigate to the project root dir cd /path/to/project # install vendor dependencies composer install # execute the init command and select the appropriate environment: # dev - for development # prod - for production # starter - this is used only for the the starter project setup (https://github.com/presentator/presentator-starter) php init
Create a new database (with
utf8mb4_unicode_cicollation) and adjust the db, mailer and other component configurations in
All available app components with their default values could be found in
Adjust the application parameters in
All available app parameters with their default values could be found in
Apply DB migrations.
php /path/to/project/yii migrate
(optional) Setup a cron task to process unread screen comments:
# Every 30 minutes processes all unread screen comments and sends an email to the related users. */30 * * * * php /path/to/project/yii mails/process-comments
That's it! You should be able to make HTTP requests to the previously defined server address.
Additional console commands you may find useful:
# set Super User access rights to a single User model php /path/to/project/yii users/super email@example.com # set Regular User access rights to a single User model php /path/to/project/yii users/regular firstname.lastname@example.org # regenerates all screen thumbs php /path/to/project/yii screens/generate-thumbs
Presentator uses Codeception as its primary test framework.
Running tests require an additional database, which will be cleaned up between tests.
Create a new database and edit the db component settings in
config/test-local.php and then run the following console commands:
# apply db migrations for the test database php path/to/project/yii_test migrate # build the test suites /path/to/project/vendor/bin/codecept build # start all application tests /path/to/project/vendor/bin/codecept run
Currently only functional tests are available.
The project makes use of the following conventions:
- (PHP) Each class must follow the accepted PSR standards.
- (PHP) Each class method should have comment block tags based on PHPDoc (method description is optional).
- (DB) Use InnoDB table engine.
- (DB) Use
- (DB) Table names must match with the corresponding AR model class name (eg.
- (DB) Table columns must be in camelCase format (eg.
- (DB) Each database change must be applied via Yii migrations.
- (DB) Whenever is possible add named foreign keys and indexes in the following format