Skip to content

Commit 8198250

Browse files
authored
psx migration (#33)
1 parent ee0bb04 commit 8198250

File tree

1,037 files changed

+38846
-55646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,037 files changed

+38846
-55646
lines changed

.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
APP_URL=http://127.0.0.1
2+
APP_APPS_URL=http://127.0.0.1/apps
3+
APP_ENV=dev
4+
APP_DEBUG=true
5+
APP_CONNECTION=pdo-sqlite://:memory:
6+
APP_MAILER=native://default
7+
APP_MAIL_SENDER=

.github/workflows/ci.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,25 @@ jobs:
1212
- name: Install PHP
1313
uses: shivammathur/setup-php@v2
1414
with:
15-
php-version: 8.0
15+
php-version: 8.1
1616
coverage: none
1717
- name: Composer install
1818
run: composer install --no-interaction --no-ansi --no-progress
1919
- name: Run Psalm
2020
run: vendor/bin/psalm --no-progress --shepherd --show-info=false --stats
2121
phpunit:
2222
needs: psalm
23-
name: "PHPUnit (PHP: ${{ matrix.php-versions }}-${{ matrix.database }})"
23+
name: "PHPUnit (PHP: ${{ matrix.php-version }}-${{ matrix.connection }})"
2424
runs-on: ubuntu-latest
2525
strategy:
2626
matrix:
27-
php-versions:
28-
- 8.0
27+
php-version:
2928
- 8.1
30-
database:
31-
- sqlite
32-
- postgres
33-
- mysql
34-
exclude:
35-
# exclude PHP 8.0 mysql build which is really slow
36-
- php-versions: 8.0
37-
database: mysql
29+
- 8.2
30+
connection:
31+
- 'pdo-sqlite://:memory:'
32+
- 'pdo-pgsql://postgres:postgres@localhost/fusio'
33+
- 'pdo-mysql://root:test1234@localhost/fusio'
3834
services:
3935
postgres:
4036
image: postgres
@@ -50,7 +46,7 @@ jobs:
5046
- name: Install PHP
5147
uses: shivammathur/setup-php@v2
5248
with:
53-
php-version: ${{ matrix.php-versions }}
49+
php-version: ${{ matrix.php-version }}
5450
coverage: none
5551
- name: Setup MySQL
5652
run: |
@@ -61,9 +57,9 @@ jobs:
6157
run: composer install --no-interaction --no-ansi --no-progress
6258
- name: Wait for
6359
env:
64-
DB: ${{ matrix.database }}
60+
APP_CONNECTION: ${{ matrix.connection }}
6561
run: php bin/fusio system:wait_for
6662
- name: Run PHPUnit
6763
env:
68-
DB: ${{ matrix.database }}
64+
APP_CONNECTION: ${{ matrix.connection }}
6965
run: vendor/bin/phpunit

LICENSE

Lines changed: 176 additions & 619 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,33 @@ Fusio implementation
33

44
# About
55

6-
Fusio is an open source API management platform which helps to build and manage
7-
RESTful APIs. This repository contains the Fusio backend code. More information
8-
about Fusio at https://www.fusio-project.org/
6+
Fusio is an open source API management platform which helps to create innovative API solutions. This repository contains
7+
the Fusio backend code. More information about Fusio at https://www.fusio-project.org/
8+
9+
# Status
10+
11+
This overview shows all Fusio related composer dependencies and the build status:
12+
13+
| Package | Status |
14+
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
15+
| [fusio/impl](https://github.com/apioo/fusio-impl) | ![Status](https://github.com/apioo/fusio-impl/actions/workflows/ci.yml/badge.svg) |
16+
| [fusio/cli](https://github.com/apioo/fusio-cli) | ![Status](https://github.com/apioo/fusio-cli/actions/workflows/ci.yml/badge.svg) |
17+
| [fusio/model](https://github.com/apioo/fusio-model) | ![Status](https://github.com/apioo/fusio-model/actions/workflows/ci.yml/badge.svg) |
18+
| [fusio/engine](https://github.com/apioo/fusio-engine) | ![Status](https://github.com/apioo/fusio-engine/actions/workflows/ci.yml/badge.svg) |
19+
| [fusio/adapter-amqp](https://github.com/apioo/fusio-adapter-amqp) | ![Status](https://github.com/apioo/fusio-adapter-amqp/actions/workflows/ci.yml/badge.svg) |
20+
| [fusio/adapter-beanstalk](https://github.com/apioo/fusio-adapter-beanstalk) | ![Status](https://github.com/apioo/fusio-adapter-beanstalk/actions/workflows/ci.yml/badge.svg) |
21+
| [fusio/adapter-cli](https://github.com/apioo/fusio-adapter-cli) | ![Status](https://github.com/apioo/fusio-adapter-cli/actions/workflows/ci.yml/badge.svg) |
22+
| [fusio/adapter-elasticsearch](https://github.com/apioo/fusio-adapter-elasticsearch) | ![Status](https://github.com/apioo/fusio-adapter-elasticsearch/actions/workflows/ci.yml/badge.svg) |
23+
| [fusio/adapter-fcgi](https://github.com/apioo/fusio-adapter-fcgi) | ![Status](https://github.com/apioo/fusio-adapter-fcgi/actions/workflows/ci.yml/badge.svg) |
24+
| [fusio/adapter-file](https://github.com/apioo/fusio-adapter-file) | ![Status](https://github.com/apioo/fusio-adapter-file/actions/workflows/ci.yml/badge.svg) |
25+
| [fusio/adapter-graphql](https://github.com/apioo/fusio-adapter-graphql) | ![Status](https://github.com/apioo/fusio-adapter-graphql/actions/workflows/ci.yml/badge.svg) |
26+
| [fusio/adapter-http](https://github.com/apioo/fusio-adapter-http) | ![Status](https://github.com/apioo/fusio-adapter-http/actions/workflows/ci.yml/badge.svg) |
27+
| [fusio/adapter-memcache](https://github.com/apioo/fusio-adapter-memcache) | ![Status](https://github.com/apioo/fusio-adapter-memcache/actions/workflows/ci.yml/badge.svg) |
28+
| [fusio/adapter-mongodb](https://github.com/apioo/fusio-adapter-mongodb) | ![Status](https://github.com/apioo/fusio-adapter-mongodb/actions/workflows/ci.yml/badge.svg) |
29+
| [fusio/adapter-php](https://github.com/apioo/fusio-adapter-php) | ![Status](https://github.com/apioo/fusio-adapter-php/actions/workflows/ci.yml/badge.svg) |
30+
| [fusio/adapter-redis](https://github.com/apioo/fusio-adapter-redis) | ![Status](https://github.com/apioo/fusio-adapter-redis/actions/workflows/ci.yml/badge.svg) |
31+
| [fusio/adapter-smtp](https://github.com/apioo/fusio-adapter-smtp) | ![Status](https://github.com/apioo/fusio-adapter-smtp/actions/workflows/ci.yml/badge.svg) |
32+
| [fusio/adapter-soap](https://github.com/apioo/fusio-adapter-soap) | ![Status](https://github.com/apioo/fusio-adapter-soap/actions/workflows/ci.yml/badge.svg) |
33+
| [fusio/adapter-sql](https://github.com/apioo/fusio-adapter-sql) | ![Status](https://github.com/apioo/fusio-adapter-sql/actions/workflows/ci.yml/badge.svg) |
34+
| [fusio/adapter-stripe](https://github.com/apioo/fusio-adapter-stripe) | ![Status](https://github.com/apioo/fusio-adapter-stripe/actions/workflows/ci.yml/badge.svg) |
35+
| [fusio/adapter-util](https://github.com/apioo/fusio-adapter-util) | ![Status](https://github.com/apioo/fusio-adapter-util/actions/workflows/ci.yml/badge.svg) |

bin/fusio

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,27 @@ $files = array(
2727

2828
$autoloadFile = null;
2929

30-
foreach($files as $file)
31-
{
32-
if(file_exists($file))
33-
{
30+
foreach ($files as $file) {
31+
if (file_exists($file)) {
3432
$autoloadFile = $file;
3533
break;
3634
}
3735
}
3836

39-
if(!empty($autoloadFile))
40-
{
37+
if (!empty($autoloadFile)) {
4138
require_once($autoloadFile);
4239

43-
$containerFile = strstr($autoloadFile, 'autoload.php', true) . '../container.php';
40+
$containerFile = strstr($autoloadFile, 'autoload.php', true) . '../container.php';
4441

45-
if(is_file($containerFile))
46-
{
42+
if (is_file($containerFile)) {
4743
$container = require_once($containerFile);
4844

49-
PSX\Framework\Bootstrap::setupEnvironment($container->get('config'));
45+
PSX\Framework\Bootstrap::setupEnvironment();
5046

51-
$container->get('console')->run();
52-
}
53-
else
54-
{
47+
$container->get(\Symfony\Component\Console\Application::class)->run();
48+
} else {
5549
die('Could not find container at: ' . $containerFile);
5650
}
57-
}
58-
else
59-
{
51+
} else {
6052
die('You need to set up the project dependencies through composer');
6153
}

composer.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "fusio/impl",
33
"description": "Fusio implementation",
44
"homepage": "https://www.fusio-project.org",
5-
"license": "AGPL-3.0-only",
5+
"license": "Apache-2.0",
66
"authors": [
77
{
88
"name": "Christoph Kappestein",
@@ -15,33 +15,32 @@
1515
"psalm": "@php vendor/vimeo/psalm/psalm"
1616
},
1717
"require": {
18-
"php": ">=8.0",
19-
"psx/framework": "^6.0",
18+
"php": ">=8.1",
19+
"psx/framework": "^7.1",
2020
"psx/openssl": "^2.0",
2121
"psx/cloudevents": "^1.0",
22-
"fusio/cli": "^2.0",
23-
"fusio/model": "^2.0",
24-
"fusio/engine": "^5.0",
25-
"fusio/adapter-file": "^5.0",
26-
"fusio/adapter-graphql": "^5.0",
27-
"fusio/adapter-http": "^5.0",
28-
"fusio/adapter-php": "^5.0",
29-
"fusio/adapter-smtp": "^5.0",
30-
"fusio/adapter-soap": "^5.0",
31-
"fusio/adapter-sql": "^5.0",
32-
"fusio/adapter-util": "^5.0",
33-
"fusio/adapter-cli": "^5.0",
34-
"fusio/adapter-fcgi": "^5.0",
35-
"firebase/php-jwt": "^5.0",
36-
"doctrine/migrations": "^2.3",
37-
"symfony/filesystem": "^5.0|^6.0",
22+
"fusio/cli": "^3.0",
23+
"fusio/model": "^3.0",
24+
"fusio/engine": "^6.0",
25+
"fusio/adapter-file": "^6.0",
26+
"fusio/adapter-graphql": "^6.0",
27+
"fusio/adapter-http": "^6.0",
28+
"fusio/adapter-php": "^6.0",
29+
"fusio/adapter-smtp": "^6.0",
30+
"fusio/adapter-soap": "^6.0",
31+
"fusio/adapter-sql": "^6.0",
32+
"fusio/adapter-util": "^6.0",
33+
"fusio/adapter-cli": "^6.0",
34+
"fusio/adapter-fcgi": "^6.0",
35+
"firebase/php-jwt": "^6.0",
36+
"symfony/filesystem": "^6.0",
3837
"symfony/mailer": "^6.0",
39-
"packaged/thrift": "^0.15",
38+
"apache/thrift": "^0.18",
4039
"dragonmantank/cron-expression": "^3.3"
4140
},
4241
"require-dev": {
43-
"phpunit/phpunit": "^8.0",
44-
"vimeo/psalm": "^4.0"
42+
"phpunit/phpunit": "^9.0",
43+
"vimeo/psalm": "^5.0"
4544
},
4645
"autoload": {
4746
"psr-4": {

configuration.php

Lines changed: 26 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

3-
return array(
3+
use Monolog\Logger;
4+
use function Symfony\Component\DependencyInjection\Loader\Configurator\env;
5+
6+
return [
47

58
// This array contains a list of worker endpoints which can be used by Fusio to execute action code in different
69
// programming languages. For more information please take a look at our worker documentation:
7-
// https://www.fusio-project.org/documentation/worker
10+
// https://docs.fusio-project.org/docs/concepts/worker_api/
811
/*
912
'fusio_worker' => [
1013
'java' => 'localhost:9090',
@@ -34,12 +37,8 @@
3437
// provider file for more information
3538
'fusio_provider' => __DIR__ . '/provider.php',
3639

37-
// Settings of the internal mailer. More information s.
38-
// https://symfony.com/doc/current/mailer.html#using-built-in-transports
39-
'fusio_mailer' => 'native://default',
40-
4140
// Describes the default email which Fusio uses as from address
42-
'fusio_mail_sender' => null,
41+
'fusio_mail_sender' => env('APP_MAIL_SENDER')->string(),
4342

4443
// Indicates whether the marketplace is enabled. If yes it is possible to download and install other apps through
4544
// the backend
@@ -49,83 +48,41 @@
4948
'fusio_marketplace_url' => 'https://www.fusio-project.org/marketplace.yaml',
5049

5150
// The public url to the apps folder (i.e. http://acme.com/apps or http://apps.acme.com)
52-
'fusio_apps_url' => 'http://127.0.0.1/apps',
51+
'fusio_apps_url' => env('APP_APPS_URL')->string(),
5352

5453
// Location where the apps are persisted from the marketplace. By default this is the public dir to access the apps
5554
// directly, but it is also possible to specify a different folder
5655
'fusio_apps_dir' => __DIR__ . '/apps',
5756

58-
// The public url to the public folder (i.e. http://acme.com/public or http://acme.com)
59-
'psx_url' => 'http://127.0.0.1',
57+
// The url to the psx public folder (i.e. http://api.acme.com or http://127.0.0.1/psx/public)
58+
'psx_url' => env('APP_URL')->string(),
6059

61-
// To enable clean urls you need to set this to '' this works only in case mod rewrite is activated
60+
// The input path 'index.php/' or '' if every request is served to the index.php file
6261
'psx_dispatch' => '',
6362

64-
// The default timezone
65-
'psx_timezone' => 'UTC',
63+
// Defines the current environment i.e. prod or dev
64+
'psx_env' => env('APP_ENV')->string()->default('prod'),
6665

67-
// Whether PSX runs in debug mode or not. If not error reporting is set to 0 also several caches are used if the
68-
// debug mode is false
69-
'psx_debug' => true,
66+
// Whether the app runs in debug mode or not. If not error reporting is set to 0, also several caches are used if
67+
// the debug mode is false
68+
'psx_debug' => env('APP_DEBUG')->bool()->default(false),
7069

7170
// Database parameters which are used for the doctrine DBAL connection
7271
// http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html
73-
'psx_connection' => getConnectionParams(getenv('DB')),
72+
'psx_connection' => env('APP_CONNECTION')->string(),
73+
74+
// Mailer connection which is used to send mails
75+
// https://symfony.com/doc/current/mailer.html#using-built-in-transports
76+
'psx_mailer' => env('APP_MAILER')->string(),
77+
78+
'psx_migration_namespace' => 'Fusio\\Impl\\Migrations',
79+
80+
'psx_log_level' => Logger::ERROR,
7481

7582
// Folder locations
7683
'psx_path_cache' => __DIR__ . '/cache',
84+
'psx_path_log' => __DIR__ . '/log',
7785
'psx_path_public' => __DIR__ . '/public',
7886
'psx_path_src' => __DIR__ . '/src',
7987

80-
// Supported writers
81-
'psx_supported_writer' => [
82-
\PSX\Data\Writer\Json::class,
83-
\PSX\Data\Writer\Jsonp::class,
84-
\PSX\Data\Writer\Jsonx::class,
85-
],
86-
87-
// Global middleware which are applied before and after every request. Must bei either a classname, closure or
88-
// PSX\Http\FilterInterface instance
89-
//'psx_filter_pre' => [],
90-
//'psx_filter_post' => [],
91-
92-
// A closure which returns a symfony cache implementation. If null the filesystem cache is used. Please take a look
93-
//'psx_cache_factory' => null,
94-
95-
// Specify a specific log level
96-
//'psx_log_level' => \Monolog\Logger::ERROR,
97-
98-
// A closure which returns a monolog handler implementation. If null the system handler is used
99-
//'psx_logger_factory' => null,
100-
101-
);
102-
103-
function getConnectionParams($db)
104-
{
105-
switch ($db) {
106-
case 'mysql':
107-
return [
108-
'dbname' => 'fusio',
109-
'user' => 'root',
110-
'password' => 'test1234',
111-
'host' => 'localhost',
112-
'driver' => 'pdo_mysql',
113-
];
114-
115-
case 'postgres':
116-
return [
117-
'dbname' => 'fusio',
118-
'user' => 'postgres',
119-
'password' => 'postgres',
120-
'host' => 'localhost',
121-
'driver' => 'pdo_pgsql',
122-
];
123-
124-
default:
125-
case 'sqlite':
126-
return [
127-
'memory' => true,
128-
'driver' => 'pdo_sqlite',
129-
];
130-
}
131-
}
88+
];

container.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?php
22

3-
/*
4-
This file returns the global DI container for the application. The DI container
5-
which gets returned must be compatible with the symfony DI container interface.
6-
If you want load an different configuration depending on the environment you can
7-
change the "config.file" parameter.
8-
*/
9-
10-
$container = new Fusio\Impl\Dependency\Container();
11-
$container->setParameter('config.file', __DIR__ . '/configuration.php');
12-
13-
return $container;
3+
return \PSX\Framework\Dependency\ContainerBuilder::build(
4+
__DIR__,
5+
true,
6+
__DIR__ . '/vendor/psx/framework/resources/container.php',
7+
__DIR__ . '/resources/container.php',
8+
__DIR__ . '/tests/test_container.php',
9+
...\Fusio\Impl\Adapter\AdapterFinder::getFiles(__DIR__ . '/provider.php')
10+
);

phpunit.xml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="tests/bootstrap.php">
3-
<testsuites>
4-
<testsuite name="Test Suite">
5-
<directory>./tests</directory>
6-
</testsuite>
7-
</testsuites>
8-
<filter>
9-
<whitelist processUncoveredFilesFromWhitelist="true">
10-
<directory suffix=".php">./src</directory>
11-
</whitelist>
12-
</filter>
13-
<php>
14-
<!--<env name="DB" value="mysql" />-->
15-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Test Suite">
10+
<directory>./tests</directory>
11+
</testsuite>
12+
</testsuites>
1613
</phpunit>

0 commit comments

Comments
 (0)