PHPackages                             lcloss/php-sql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. lcloss/php-sql

ActiveLibrary[Database &amp; ORM](/categories/database)

lcloss/php-sql
==============

Simple SQL class to use with PHP

019PHP

Since Feb 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/lcloss/php-sql)[ Packagist](https://packagist.org/packages/lcloss/php-sql)[ RSS](/packages/lcloss-php-sql/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-sql
=======

[](#php-sql)

A simple Class to work with SQL in PHP

Getting Started
---------------

[](#getting-started)

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

### Prerequisites

[](#prerequisites)

You will need a web server and PHP configured. Also, you need to use one of these databases systems:

- MariaDB or MySql
- SQL Server
- SQLite

This project is intended to be incorporated into another project, so the minimum prerequisite is the web server, PHP and a Database driver as mentioned above.

### Installing

[](#installing)

Installation with Git:

```
git clone https://github.com/lcloss/php-sql.git

```

Instalação com o Composer:

```
composer require lcloss/php-sql

```

Running the tests
-----------------

[](#running-the-tests)

### Initial setup

[](#initial-setup)

If you are using MariaDb, MySQL or SQL Server, you need to create the database schema first.

With your data, write:

```

```

### Returning Data

[](#returning-data)

```
$sql = new Sql();
$results = $sql->query("SELECT * FROM table WHERE id = :id", [
	':id'		=> 1
]);

if ( count($results) > 0 ) {
	echo 'Found!';
} else {
	echo 'Not Found...';
}

```

### Executing SQL

[](#executing-sql)

Type the following code:

```
$sql = new Sql();
$sql->query("UPDATE table SET name = :name WHERE id = :id", [
	':id'		=> 1,
	':name'	=> 'New name',
]);

```

Built With
----------

[](#built-with)

Contributing
------------

[](#contributing)

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

Versioning
----------

[](#versioning)

We use [GitHub](https://github.com/) for versioning. For the versions available, see the [tags on this repository](https://github.com/lcloss/php-sql/tags).

Authors
-------

[](#authors)

- **Luciano Closs** - *Initial work* - [LCloss](https://github.com/lcloss)

See also the list of [contributors](https://github.com/lcloss/php-sql/contributors) who participated in this project.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

Acknowledgments
---------------

[](#acknowledgments)

- This project was inspired by the [Curso Completo de PHP 7](https://www.udemy.com/curso-php-7-online/) from [HCode](https://www.hcode.com.br/)
- This README.md was build from [PurpleBooth README Template](https://gist.github.com/PurpleBooth/109311bb0361f32d87a2)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10761341?v=4)[Luciano Closs](/maintainers/lcloss)[@lcloss](https://github.com/lcloss)

---

Top Contributors

[![lcloss](https://avatars.githubusercontent.com/u/10761341?v=4)](https://github.com/lcloss "lcloss (17 commits)")

### Embed Badge

![Health badge](/badges/lcloss-php-sql/health.svg)

```
[![Health](https://phpackages.com/badges/lcloss-php-sql/health.svg)](https://phpackages.com/packages/lcloss-php-sql)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M117](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
