Perfect README

项目的 README,来自 github.com/PerfectlySoft/Perfect。合并为一个 markdown 文件:README.md。

Perfect: Server-Side Swift

Swift 6.2+ Platforms macOS 12+ | Linux License Apache 2.0

Perfect is a set of focused Swift packages for building servers and talking to the services behind them: an HTTP(S) server, database drivers, sessions and sign-in, email, push notifications, FileMaker, payments and everyday utilities. Every package is written for Swift 6 and strict concurrency, runs on macOS and Linux, keeps its dependencies to a minimum, and is released and tested on its own.

This repository used to hold PerfectLib, the original all-in-one Perfect framework (Swift 3 to 5). PerfectLib is no longer maintained. Its code is preserved on the legacy branch, and its tags (the last is 4.0.1) still resolve. This repository is now the map to the Perfect packages.

Start here

.package(url: "https://github.com/PerfectlySoft/Perfect-NIO.git", from: "0.2.0"),

Packages

Server and web

Package What it does
Perfect-NIO HTTP(S) server on SwiftNIO: typed routes, async handlers, WebSockets, multi-domain TLS, optional admin console
Perfect-Session Sessions with MySQL, PostgreSQL, SQLite, Redis, MongoDB or in-memory storage, plus CSRF, CORS and cookie helpers
Perfect-Authentication OAuth 2.0 sign-in with PKCE for Google, GitHub, Facebook, Slack, LinkedIn and Salesforce
Perfect-SMTP SMTP client on SwiftNIO: relay or direct-to-MX delivery, DKIM signing, MTA-STS
Perfect-Notifications Apple Push Notification service (APNs) provider client over HTTP/2

Databases

Package What it does
Perfect-CRUD Codable object-relational mapping: create tables, insert, update, select and join with type-safe queries
Perfect-MySQL MySQL client and Perfect-CRUD driver
Perfect-MariaDB MariaDB client and Perfect-CRUD driver
Perfect-PostgreSQL PostgreSQL client (libpq) and Perfect-CRUD driver
Perfect-SQLite SQLite client and Perfect-CRUD driver
Perfect-MongoDB MongoDB client: connection pools, collections, cursors, BSON and GridFS
Perfect-Redis Async Redis client

FileMaker

Package What it does
Perfect-FileMaker Client for FileMaker Server's XML Custom Web Publishing interface
Perfect-FileMaker-DataAPI Client for the FileMaker Data API (REST/JSON)
Perfect-FileMaker-AdminAPI Client for the FileMaker Server Admin API, with a janitor that clears stale web-publishing sessions

Payments

Package What it does
Perfect-AuthNet Authorize.net client: charge, authorize, capture, refund and void, including Accept.js nonces

Utilities

Package What it does
Perfect-Logger File and remote log handlers for swift-log
Perfect-XML XML and HTML parsing with XPath, on libxml2
Perfect-Zip Create and safely extract zip archives
Perfect-INIParser INI configuration file parser

Each package's README lists its requirements, its current release and how to add it to Package.swift. All of them need Swift 6.2 or later and run on macOS 12 or later and Linux. Perfect-CRUD, Perfect-SQLite, Perfect-Redis, Perfect-FileMaker and Perfect-XML also support iOS.

Coming from PerfectLib

The packages that PerfectLib and its companions provided have been replaced like this:

Before Now
Perfect-HTTP, Perfect-HTTPServer, Perfect-Net, Perfect-FastCGI Perfect-NIO
Perfect-WebSockets WebSocket routes in Perfect-NIO
Perfect-Session-MySQL, -PostgreSQL, -SQLite, -Redis Perfect-Session
Perfect-OAuth2, Perfect-Turnstile-*, Perfect-LocalAuthentication-* Perfect-Authentication with Perfect-Session
Perfect-CURL Foundation's URLSession
Perfect-Crypto swift-crypto
Perfect-Thread Swift concurrency (async/await, tasks and actors)
PerfectLib's File and Dir Foundation's FileManager and FileHandle
PerfectLib's JSONConvertible Codable with JSONEncoder and JSONDecoder
PerfectLib's SysProcess Foundation's Process
PerfectLib's Log Perfect-Logger on swift-log

The old repositories are archived: they stay readable and their tags still resolve, but they don't get updates. Every package that existed before Swift 6 keeps its old code on a legacy branch, and its README has a migration section.

Some older packages are still being reviewed before they're brought up to date, including Perfect-Mustache, Perfect-Markdown and Perfect-LDAP. Until then they stay as they are.

Contributing

Issues and pull requests are welcome on each package's own repository. Please follow the Code of Conduct.

License

Apache 2.0. See LICENSE.

Perfect (PerfectlySoft/Perfect)

正在搜索数据库…

这是什么?Perfect 是一套面向服务器端 Swift 的完整工具箱、框架和应用服务器:Swift 开发者可以用它完全使用 Swift 来搭建网站、REST 服务和移动端后端。
那它到底是一个框架、一个库,还是一整台服务器?三者兼具。这个仓库存放核心的 PerfectLib,其他独立的模块则提供 HTTP 1.1 服务器、数据库连接器、WebSocket、Mustache 模板等功能——你可以按服务需要自行组装这些组件。
我该怎么开始第一个项目?克隆 Perfect Template 起步项目,然后用 Swift Package Manager 编译,它会生成一个独立的可执行 HTTP 服务器。官方还同步发布了新手教程和完整的 API 参考文档。
在开始构建之前,我需要安装什么?只需要 Swift 本身:master 分支可以在 Xcode 11 或 Ubuntu 上的 Swift 5 工具链下编译,所以一台装了 Xcode 的 Mac,或一台装了 Swift 5 的 Ubuntu 机器就足够了。
这个项目还在积极维护吗?没有了。这个仓库现在被标记为 Legacy Perfect(遗留版本),可以把它看作一个成熟但已冻结的项目:用来学习或维护现有服务没问题,但如果要在它上面开发新东西,请先确认兼容性。
我必须是 Swift 开发者才能用它吗?是的——Perfect 是为希望在客户端和服务器端使用同一种语言的 Swift 工程师打造的,不过配套指南面向各种水平的开发者。
做好的服务可以部署到哪里?任何支持 Swift 的 Linux 服务器都可以。另外还有一个 Perfect Assistant,这是一款 macOS 桌面应用,可以帮助部署到 AWS 和 Google Cloud。
它开箱即支持连接哪些数据库?官方提供 Redis、SQLite、PostgreSQL、MySQL、MongoDB 和 FileMaker Server 的连接器,另外还有一个 FastCGI 模块,如果你通过 Apache 托管而不是用内置服务器,可以用它配合 Apache 2.4。
为什么用 Swift 来写 Web 服务器?卖点是全栈统一使用一种语言:iOS 和 macOS 开发者可以用同一套工具同时开发自己的应用和服务器端 REST 服务,README 中说这能提升开发效率。
它的网络层是异步的吗?是的。Perfect 运行在一个完全异步、高性能的网络引擎上,目标是支撑可扩展的互联网服务,而且你可以把内置的 JSON 或模板系统换成自己喜欢的那套。
有哪些示例项目可以学习?社区示例包括一个 WebSocket 服务器、URL 路由和一个上传文件枚举器,Perfect Examples 仓库里还有更多示例,并配有入门教程帮助你迈出第一步。
有哪些类似的项目?drogon, aiohttp, vapor, chat, sails, gin-vue-admin, echo, actix-web
大小
5.3 MB
星标
13.7K
时长
11年
提交 · 90 天