slimphp/Slim là một trong những repo hướng lập trình viên mà TopGit theo dõi, hiện có 12.3k sao, viết chủ yếu bằng PHP. Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs.
Installation
It's recommended that you use Composer to install Slim.
composer require slim/slim
This will install Slim and all required dependencies. Slim requires PHP 7.4 or newer.
Choose a PSR-7 Implementation & ServerRequest Creator
Before you can get up and running with Slim you will need to choose a PSR-7 implementation that best fits your application. A few notable ones:
Slim-Psr7 - This is the Slim Framework PSR-7 implementation
httpsoft/http-message & httpsoft/http-server-request - This is the fastest, strictest and most lightweight implementation available
Nyholm/psr7 & Nyholm/psr7-server - Performance is almost the same as the HttpSoft implementation
Guzzle/psr7 - This is the implementation used by the Guzzle Client, featuring extra functionality for stream and file handling
laminas-diactoros - This is the Laminas (Zend) PSR-7 implementation
Slim-Http Decorators
Slim-Http is a set of decorators for any PSR-7 implementation that we recommend is used with Slim Framework.
To install the Slim-Http library simply run the following command:
composer require slim/http
The ServerRequest and Response object decorators are automatically detected and applied by the internal factories. If you have installed Slim-Http and wish to turn off automatic object decoration then you can use the following statements:
<?php
use Slim\Factory\AppFactory;
use Slim\Factory\ServerRequestCreatorFactory;
AppFactory::setSlimHttpDecoratorsAutomaticDetection(false);
ServerRequestCreatorFactory::setSlimHttpDecoratorsAutomaticDetection(false);
$app = AppFactory::create();
// ...
Hello World using AppFactory with PSR-7 auto-detection
In order for auto-detection to work and enable you to use AppFactory::create() and App::run() without having to manually create a ServerRequest you need to install one of the following implementations:
Slim-Psr7 - Install using composer require slim/psr7
Nyholm/psr7 & Nyholm/psr7-server - Install using composer require nyholm/psr7 nyholm/psr7-server
Guzzle/psr7 - Install using composer require guzzlehttp/psr7
laminas-diactoros - Install using composer require laminas/laminas-diactoros
Then create file public/index.php.
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
// Instantiate App
$app = AppFactory::create();
// Add error middleware
$app->addErrorMiddleware(true, true, true);
// Add routes
$app->get('/', function (Request $request, Response $response) {
$response->getBody()->write('<a href="/hello/world">Try /hello/world</a>');
return $response;
});
$app->get('/hello/{name}', function (Request $request, Response $response, $args) {
$name = $args['name'];
$response->getBody()->write("Hello, $name");
return $response;
});
$app->run();
You may quickly test this using the built-in PHP server:
php -S localhost:8000 -t public
Going to http://localhost:8000/hello/world will now display "Hello, world".
For more information on how to configure your web server, see the Documentation.
Tests
To execute the test suite, you'll need to install all development dependencies.
git clone https://github.com/slimphp/Slim
composer install
composer test
Contributing
Please see CONTRIBUTING for details.
Learn More
Learn more at these links:
Website
Documentation
Slack
Support Forum
Twitter
Resources
Security
If you discover security related issues, please email [email protected] instead of using the issue tracker.
For enterprise
Available as part of the Tidelift Subscription.
The maintainers of Slim and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
Contributors
Code Contributors
This project exists thanks to all the people who contribute. Contribute.
Financial Contributors
Become a financial contributor and help us sustain our community. Contribute
Individuals
Organizations
Support this project with your organization. Your logo will show up here with a link to your website. Contribute
License
The Slim Framework is licensed under the MIT license. See License File for more information.
slimphp/Slim thuộc nhóm Developer Tools trên TopGit, cùng 9 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về slimphp/Slim ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/slimphp/Slim là nguồn chính thức.
slimphp/Slim có bao nhiêu sao?
slimphp/Slim có 12.3k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/slimphp/Slim. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
slimphp/Slim có những chủ đề gì?
GitHub topics của slimphp/Slim: "framework", "micro-framework", "php", "php-micro-framework", "psr-15", "psr-3", "psr-7", "slim", "slim-framework". TopGit xếp repo vào nhóm Developer Tools.
slimphp/Slim còn đang phát triển không?
Commit gần nhất trên slimphp/Slim là 4 tháng trước (theo timestamp GitHub). Repo có 2.0k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
slimphp/Slim viết bằng ngôn ngữ gì?
slimphp/Slim chủ yếu viết bằng PHP. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao slimphp/Slim được xếp vào nhóm Developer Tools?
TopGit xếp slimphp/Slim vào nhóm Developer Tools dựa trên GitHub topics và mô tả của repo (gắn thẻ: "framework", "micro-framework", "php"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Slim có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về Slim.