Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
style(EnvironmentLoader): Use Dotenv to load Loads environment variables
Browse files Browse the repository at this point in the history
1. Use Dotenv\Dotenv to load Loads environment variables from `.env` automagically.
2. ucfirst Folder of `Framework`
  • Loading branch information
Rhilip committed Sep 11, 2019
1 parent c4cc457 commit e6394a6
Show file tree
Hide file tree
Showing 81 changed files with 240 additions and 66 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- **Auth/Login:** Fix user can't login after commit `6009dc8` (d509127)
- **Component:** Fix parent::onRequest{Before,After} miss (200926f)
- **Search:** Search keywords in NPHP ways (ccde9c0)
- **Torrent/Comment:** Fix user can't see anonymous uploader's comment (bd2d821)
- **User:** Fix User Class miss in string format (3680444)

### Perf
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion framework/functions.php → Framework/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function app($prefix = null)
*/
function env($name = null, $default = '')
{
return \Rid\Base\Env::get($name, $default);
return getenv($name) ?? $default;
}
}

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ edit in Admin Panel.
5. Run Test by `php bin/rid-httpd service start -u` , And Congratulation If you see those output **without error throwout**.

```bash
root@ridpt:/data/wwwroot/ridpt.rhilip.info# php bin/rid-httpd service start
root@ridpt:/data/wwwroot/ridpt.rhilip.info# php rid-httpd service start
____ __ ____ ______
/\ _`\ __ /\ \/\ _`\ /\__ _\
\ \ \L\ \/\_\ \_\ \ \ \L\ \/_/\ \/
Expand Down Expand Up @@ -169,6 +169,7 @@ Or you can join our chat group on Telegram -- [@ridpt](https://t.me/ridpt)
| Library | Used As | Docs |
|:--|:--:|:--|
| [MixPHP](https://github.com/mix-php/mix-framework/tree/v1) | Framework | <https://www.kancloud.cn/onanying/mixphp1/379324> ( Chinese Version ) |
| [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) | phpdotenv | <https://github.com/vlucas/phpdotenv> |
| [siriusphp/validation](https://github.com/siriusphp/validation) | Validator | <http://www.sirius.ro/php/sirius/validation/> |
| [league/plates](https://github.com/thephpleague/plates) | Template system | <http://platesphp.com/> |
| [firebase/php-jwt](https://github.com/firebase/php-jwt) | JWT | <https://github.com/firebase/php-jwt>, <https://jwt.io/> |
Expand Down
18 changes: 0 additions & 18 deletions bin/rid-httpd

This file was deleted.

7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"ext-openssl": "*",
"ext-mbstring": "*",
"psr/log": "^1.1",
"vlucas/phpdotenv": "^3.5",
"league/plates": "^3.3",
"mjohnson/decoda": "^6.12",
"phpmailer/phpmailer": "^6.0",
Expand All @@ -40,12 +41,12 @@
},
"autoload": {
"psr-4": {
"Rid\\": "framework/",
"Rid\\": "Framework/",
"apps\\": "apps/"
},
"files": [
"framework/Rid.php",
"framework/functions.php"
"Framework/Rid.php",
"Framework/functions.php"
]
},
"repositories": {
Expand Down
185 changes: 184 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 0 additions & 42 deletions framework/Base/Env.php

This file was deleted.

48 changes: 48 additions & 0 deletions rid-httpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env php
<?php
/**
* RidPT - Yet Another Private Bittorrent Service
*
* @package RidPT
* @author Rhilip <rhilipruan@gmail.com>
*/

define('RIDPT_START', microtime(true));

/*
* --------------------------------------------------------------------------
* Register The Auto Loader
* --------------------------------------------------------------------------
*
* Composer provides a convenient, automatically generated class loader for
* our application. We just need to utilize it! We'll simply require it
* into the script here so that we don't have to worry about manual
* loading any of our classes later on. It feels great to relax.
*
*/
require __DIR__ . '/vendor/autoload.php';

/*
* --------------------------------------------------------------------------
* Check Environment of PHP
* --------------------------------------------------------------------------
*/
if (!PHP_SAPI === 'cli')
exit('Run in cli like: `php rid-httpd service start`.');

/*
* --------------------------------------------------------------------------
* Load Environment variables
* --------------------------------------------------------------------------
*/
$dotenv = Dotenv\Dotenv::create(__DIR__);
$dotenv->load();

/*
* --------------------------------------------------------------------------
* Start Swoole Server
* --------------------------------------------------------------------------
*/
$config = require __DIR__ . '/apps/config/httpd.php';
$exitCode = (new Rid\Console\Application($config))->run();
exit($exitCode);

0 comments on commit e6394a6

Please sign in to comment.