Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions frameworks/PHP/fomo/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
APP_NAME=Fomo
APP_TIMEZONE=UTC
APP_ENV=local
APP_SSL=false
APP_DEBUG=false
APP_URL=http://localhost

DB_HOST=tfb-database
DB_PORT=3306
DB_DATABASE=hello_world
DB_USERNAME=benchmarkdbuser
DB_PASSWORD=benchmarkdbpass
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_USERNAME=null
REDIS_PORT=6379
REDIS_DATABASE=0

12 changes: 12 additions & 0 deletions frameworks/PHP/fomo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.buildpath
.settings/
.project
*.patch
.idea/
.git/
runtime/
vendor/
.phpintel/
.DS_Store
*.lock
.phpunit*
26 changes: 26 additions & 0 deletions frameworks/PHP/fomo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Introduction

Fomo is a web application framework based.

We tried to implement Fomo in the simplest possible way so that anyone can use it.

Fomo supports the following:

- Simple, fast routing engine.
- Processing work in the background.
- Queued job processing.
- And more...

Fomo is very fast, simple and for use in large scale projects.

# Original intention

Here's 3 reason why you should use Fomo:

- Fomo is very simple (less to learn and train others on).
- Fomo is very fast (uses fewer resources to do the same thing).
- Fomo is another tool that developers can use to solve their complex problems in a simple way.

# Documentation

[https://fomo-framework.github.io/docs/](https://fomo-framework.github.io/docs/)
30 changes: 30 additions & 0 deletions frameworks/PHP/fomo/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Exceptions;

use Fomo\Request\Request;
use Throwable;

class Handler
{
public function notFoundHttpException(Request $request): string
{
return response()->json([
'message' => 'not found'
] , 404);
}

public function notAllowedHttpException(Request $request): string
{
return response()->json([
'message' => "this is route supported {$request->method()} method"
] , 405);
}

public function InternalErrorException(Request $request, Throwable $error): string
{
return response()->json([
'message' => 'internal error'
] , 500);
}
}
31 changes: 31 additions & 0 deletions frameworks/PHP/fomo/benchmark_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"framework": "fomo",
"tests": [
{
"default": {
"json_url": "/json",
"plaintext_url": "/plaintext",
"db_url": "/db",
"fortune_url": "/fortunes",
"query_url": "/query?queries=",
"update_url": "/update?queries=",
"port": 9000,
"approach": "Realistic",
"classification": "Micro",
"database": "mysql",
"framework": "Fomo",
"language": "PHP",
"flavor": "None",
"orm": "Full",
"platform": "swoole",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "Fomo",
"notes": "",
"versus": "swoole"
}
}
]
}

45 changes: 45 additions & 0 deletions frameworks/PHP/fomo/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "fomo/fomo",
"description": "The Fomo Framework",
"keywords": ["framework", "fomo" , "high performance"],
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Amir",
"email": "[email protected]"
}
],
"require": {
"php" : ">=8.1",
"fomo/framework": "^2.0"
},
"autoload": {
"psr-4": {
"App\\" : "app/" ,
"Database\\" : "database/",
"Storage\\Routes\\" : "storage/routes/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"fakerphp/faker": "^1.15",
"phpunit/phpunit": "^9.5"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
19 changes: 19 additions & 0 deletions frameworks/PHP/fomo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[framework]
name = "fomo"

[main]
urls.plaintext = "/plaintext"
urls.json = "/json"
urls.db = "/db"
urls.query = "/queries/"
urls.update = "/updates/"
urls.fortune = "/fortunes"
approach = "Realistic"
classification = "Fullstack"
database = "MySQL"
database_os = "Linux"
os = "Linux"
orm = "Full"
platform = "swoole"
webserver = "None"
versus = "swoole"
8 changes: 8 additions & 0 deletions frameworks/PHP/fomo/config/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'name' => env('APP_NAME' , 'Fomo'),
'timezone' => env('APP_TIMEZONE' , 'UTC'),
'faker_locale' => 'en_US' ,
'locale' => 'en' ,
];
67 changes: 67 additions & 0 deletions frameworks/PHP/fomo/config/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

return [
'default' => env('DB_CONNECTION', 'mysql'),

'connections' => [

'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', databasePath('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],

'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],

'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],

'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],

]
];
82 changes: 82 additions & 0 deletions frameworks/PHP/fomo/config/server.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

return [
/*
* mode
* SWOOLE_BASE ,
* SWOOLE_PROCESS
*/
'mode' => SWOOLE_BASE ,
'host' => '0.0.0.0',
'port' => 9000 ,
'sockType' => SWOOLE_SOCK_TCP ,
'additional' => [
'worker_num' => env('APP_WORKER_COUNT' , cpuCount() * 2) ,
/*
* log level
* SWOOLE_LOG_DEBUG (default)
* SWOOLE_LOG_TRACE
* SWOOLE_LOG_INFO
* SWOOLE_LOG_NOTICE
* SWOOLE_LOG_WARNING
* SWOOLE_LOG_ERROR
*/
'log_level' => SWOOLE_LOG_DEBUG ,
'log_file' => storagePath('logs/fomo.log') ,

/*
This key causes Fomo to receive a complete HTTP data packet and prevents it from receiving incomplete HTTP packets.
*/
'open_http_protocol' => true,
],

'ssl' => [
'ssl_cert_file' => null ,
'ssl_key_file' => null ,
] ,

/*
* The following services are created for better performance in the program, only one object is created from them and they can be used throughout the program
*/
'services' => [
Fomo\Services\Cache::class ,
Fomo\Services\Database::class ,
Fomo\Services\Language::class ,
Fomo\Services\Response::class ,
Fomo\Services\Validation::class ,
] ,

/*
* Files and folders that must be changed in real time
*/
'watcher' => [
'app',
'config',
'database',
'language',
'routes',
'composer.lock',
'.env',
] ,

/*
* Each of the following causes changes to the performance of the desired class. (so be careful in using them)
*/
'advanceMode' => [
/*
* advanced mode in Fomo\Request\Request class
*
* By activating the advanced mode in this class, you can access the data you want in an advanced way
* For example, consider that the user has sent you a array of the information of several customers.
* If the advanced mode is not active, you can only access an array of all customer information
*
* For example, the:
* $request->get('customers')
*
* But if the advanced mode is active, you can access any data you need from customers
* For example, the:
* $request->get('customers.*.name')
*/
'request' => DISABLE
]
];
13 changes: 13 additions & 0 deletions frameworks/PHP/fomo/deploy/php-async.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
opcache.enable=1
opcache.enable_cli=1
opcache.validate_timestamps=0
opcache.save_comments=0
opcache.enable_file_override=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=7963
opcache.preload_user=www-data

mysqlnd.collect_statistics = Off

memory_limit = 512M
Loading
Loading