The Swoft 2.x DB operation method is highly compatible with Laravel , making it easier to get started.


  • Configured by composer.json:
      "swoft/db": "~2.0.0" 


After starting a transaction, all operations between them are in the same transaction, but concurrent operations are not supported because they are the same connection.

Query constructor

The querier is a set of methods that encapsulate object-oriented methods to implement SQL assembly and operations. At present, only the MySQL client adopts the native PDO mode, and other types of database clients can implement themselves, refer to the configuration chapter.


There are only a few minor changes to the entity, refer to the model chapter.

SQL statement

2.x is not directly available before SQL can be called to the toSql() method to view.

Or check the running sql in Swoft\Db\Query\Processor\Processor