百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

slim-born

> 安全
开源

Slim Framework 3 和 4 的骨架应用程序具有身份验证 MVC 构建。

193 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Slim Framework 3 和 4 的骨架应用程序具有身份验证 MVC 构建。

slim-born

Slim Framework 3 or 4 skeleton application has authentication MVC construction.

The user authentication has been achieved, there is a need to install and use.

Installation

For Slim 3

bash
composer create-project "havenshen/slim-born v1.0.6" [my-app]

For Slim 4

bash
composer create-project "havenshen/slim-born 2.0" [my-app]

.env

Copy file .env.example to .env

DB_DRIVER=mysql
DB_HOST=localhost
DB_DATABASE=slimborn
DB_USERNAME=root
DB_PASSWORD=
DB_PORT=3306

Router

This is a Slim Framework Router. Reference - Slim Router

php
get('/', 'HomeController:index')->setName('home');

$app->group('', function () {
	$this->get('/auth/signup', 'AuthController:getSignUp')->setName('auth.signup');
	$this->post('/auth/signup', 'AuthController:postSignUp');

	$this->get('/auth/signin', 'AuthController:getSignIn')->setName('auth.signin');
	$this->post('/auth/signin', 'AuthController:postSignIn');
})->add(new GuestMiddleware($container));

Controller

Use Slim Framework Twig View. Reference - Twig-View

php
view->render($response, 'home.twig');
	}
}

Model

Use Laravel PHP Framework Eloquent. Reference - illuminate/database

php
update([
			'password' => password_hash($password, PASSWORD_DEFAULT)
		]);
	}
}

Middleware

php
container->auth->check()) {
			$this->container->flash->addMessage('error', 'Please sign in before doing that');
			return $response->withRedirect($this->container->router->pathFor('auth.signin'));
		}

		$response = $next($request, $response);

		return $response;
	}
}

Validation

Use the most awesome validation engine ever created for PHP. Reference - Respect/Validation

php
validator->validate($request, [
			'email' => v::noWhitespace()->notEmpty()->email()->emailAvailable(),
			'name' => v::noWhitespace()->notEmpty()->alpha(),
			'password' => v::noWhitespace()->notEmpty(),
		]);

		if ($validation->failed()) {
			return $response->withRedirect($this->router->pathFor('auth.signup'));
		}

		//	todo someting
	}
}

More basic functions

reference slim official documents - Slim Framework

Use Packages

  • illuminate/database - It also serves as the database layer of the Laravel PHP framework.
  • Respect/Validation - The most awesome validation engine ever created for PHP.
  • slimphp/Slim - Slim Framework created.
  • slimphp/Slim-Csrf - Slim Framework created.
  • slimphp/Twig-View - Slim Framework created.
  • slimphp/Slim-Flash - Slim Framework created.

Look Feel

Directory Structure

bash
|-- slim-born
	|-- app
		|-- Auth
		|-- Controllers
		|-- Middleware
		|-- Models
		|-- Validation
		|-- Routes.php
	|-- bootstrap
		|-- app.php
	|-- public
	|-- resources
	....

Testing

bash
$ phpunit

Contributing

Feel free to submit any minor enhancements, the goal here is to keep this as simple (yet as practical) as possible.

License

The MIT License (MIT). Please see License File for more information.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPauthenticationmvcmvc-frameworkskeleton

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类安全
定价开源

> 相关工具

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.