Skip to content

Instantly share code, notes, and snippets.

@ArchTaqi
Last active September 7, 2024 11:52
Show Gist options
  • Save ArchTaqi/527a9f4bb60d2f6bbb2822a6fe6538af to your computer and use it in GitHub Desktop.
Save ArchTaqi/527a9f4bb60d2f6bbb2822a6fe6538af to your computer and use it in GitHub Desktop.
QueryBuilder PHP
<?php
// Usage example:
$calculator = new Calculator();
$result = $calculator->setValue(5)->add(3)->multiply(2)->getResult();
?>
<?php
$queryBuilder = new QueryBuilder();
$query = $queryBuilder->select(['id', 'name', 'email'])
->from('users')
->where('age > 18')
->where('status = "active"')
->orderBy('name', 'DESC')
->limit(10)
->getQuery();
echo $query; // Outputs: SELECT id, name, email FROM users WHERE age > 18 AND status = "active" ORDER BY name DESC LIMIT 10
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment