diff --git a/README.md b/README.md index 61d291e..29a6771 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -
a mvc framework.
@@ -6,12 +6,55 @@ ## Installing ```shell -$ composer require blankphp/framework -vvv +$ composer require blankqwq/framework -vvv ``` -## Usage -TODO +- [ ] 文档 +- [x] 容器 + - [x] 依赖注入 + - [x] 容器清理与重新注册 +- [x] 管道 + - [x] 中间件 + - [ ] Pipeline扩展与异常 +- [x] 门面 + - [x] 基本完成 + - [ ] 清理门面中的对象 +- [x] 服务提供者 + - [x] register + - [x] boot + - [ ] publish +- [x] Session + - [x] RedisSessionHandler + - [ ] FileSessionHandler + - [ ] DatabaseSessionHandler +- [x] Database + - [x] Builder + - [x] Grammar + - [ ] Secure +- [x] Cookie +- [x] View + - [x] Builder + - [ ] make + - [ ] Diy +- [ ] 国际化 + - [ ] 国际化支持 +- [ ] 安全 + - [ ] 验证码 + - [ ] 加密 + - [ ] xss + - [x] 防注入 +- [ ] Swoole + - [ ] Websocket + - [ ] Process + - [ ] Job + - [ ] RPC + - [ ] ... +- [ ] FormValidate +- [ ] Console + - [x] ConsoleKernel + + ## Contributing diff --git a/composer.json b/composer.json index f3ba8e0..db1a5ba 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "blankphp/framework", + "name": "blankqwq/framework", "description": "a mvc framework", "license": "MIT", "authors": [ diff --git a/src/blankphp/Container.php b/src/blankphp/Container.php index 2542e7c..9d1804a 100644 --- a/src/blankphp/Container.php +++ b/src/blankphp/Container.php @@ -206,7 +206,7 @@ public function build($concrete) * @return array * 解决依赖注入问题 */ - public function resolveDepends($params = []):array + public function resolveDepends($params = []): array { // 判断参数类型 foreach ($params as $key => $param) { @@ -252,7 +252,7 @@ public function call($instance, $method = null, $construct = null, array $param } - public function flush():void + public function flush(): void { $this->classes = []; $this->alice = []; @@ -286,7 +286,7 @@ public function offsetGet($offset) * * @param offset * * @param value * */ - public function offsetSet($offset, $value):void + public function offsetSet($offset, $value): void { $this->classes[$offset] = $value; } @@ -294,12 +294,12 @@ public function offsetSet($offset, $value):void /** * @param mixed $offset */ - public function offsetUnset($offset):void + public function offsetUnset($offset): void { unset($this->binds[$offset], $this->instances[$offset]); } - public function alice($name, $class):bool + public function alice($name, $class): bool { return class_alias($class, $name); } diff --git a/src/blankphp/Facade/Driver.php b/src/blankphp/Facade/Driver.php index 19b2877..8ee08ab 100644 --- a/src/blankphp/Facade/Driver.php +++ b/src/blankphp/Facade/Driver.php @@ -10,7 +10,7 @@ class Driver extends Facade { protected static function getFacadeAccessor():string { - return "driver.factory"; + return 'driver.factory'; } } \ No newline at end of file diff --git a/src/blankphp/Route/Route.php b/src/blankphp/Route/Route.php index da841f0..85e25ad 100644 --- a/src/blankphp/Route/Route.php +++ b/src/blankphp/Route/Route.php @@ -90,7 +90,7 @@ public function func($config, \Closure $closure): void //开始设置 if (in_array($key, $key_set, true)) { $temp[$key] = $this->{'get' . ucfirst($key)}(); - $this->{'set' . ucfirst($key)}($value); + $this->{'set' . ucfirst($key)}($value, $temp[$key]); } } $closure($this); @@ -105,7 +105,7 @@ public function addRoute($methods, $uri, $action) { $uri = empty($this->prefix[0]) ? '/' . trim($uri, '/') : '/' . trim($this->prefix[0], '/') . '/' . trim($uri, '/'); $this->currentRoute = new RouteRule(); - $this->currentRoute->set($methods, count($uri) === 1 ? $uri : rtrim($uri, '/'), trim($this->controllerNamespace, '\\') . '\\' . $action, '', $this->group[0], $this->prefix[0]); + $this->currentRoute->set($methods, strlen($uri) === 1 ? $uri : rtrim($uri, '/'), trim($this->controllerNamespace, '\\') . '\\' . $action, '', $this->group[0], $this->prefix[0]); $this->routes->add($this->currentRoute, $this->currentRoute->getRule(), $methods); return $this->currentRoute; } @@ -147,9 +147,9 @@ public function group($group) } - public function setNamespace($namespace) + public function setNamespace($namespace, $parent = '') { - $this->controllerNamespace = $namespace; + $this->controllerNamespace = empty($namespace) ? $namespace : $parent . '\\' . $namespace; return $this; } @@ -283,9 +283,9 @@ public function getNamespace(): string return $this->controllerNamespace; } - public function setPrefix($prefix): void + public function setPrefix($prefix, $parent = ''): void { - array_unshift($this->prefix, $prefix); + array_unshift($this->prefix, (empty($parent) ? '/' : '/' . trim($parent, '/') . '/') . $prefix); } public function getPrefix(): string diff --git a/src/blankphp/View/View.php b/src/blankphp/View/View.php index 34c38dc..c4e1674 100644 --- a/src/blankphp/View/View.php +++ b/src/blankphp/View/View.php @@ -81,7 +81,7 @@ public function existsFile() public function getValue($result) { if (is_array($result)) { - var_dump($result); + dump($result); } else { echo $result; } diff --git a/src/helpers/Encryption.php b/src/helpers/Encryption.php new file mode 100644 index 0000000..93c50ad --- /dev/null +++ b/src/helpers/Encryption.php @@ -0,0 +1,58 @@ +all(); } $descNames = explode('.', $name); @@ -70,10 +70,23 @@ function now() } } -if (!function_exists('dump')){ - function dump($value){ - echo ''; - print_r($value); - echo ''; +if (!function_exists('dump')) { + function dump($vars, $label = 'array', $return = false) + { + if (ini_get('html_errors')) { + $content = "
\n";
+ if ($label !== '') {
+ $content .= "{$label} :\n";
+ }
+ $content .= htmlspecialchars(print_r($vars, true));
+ $content .= "\n\n