Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
712c99c
Strict types update
Vitexus Nov 20, 2024
6407150
Ensures array values are JSON-encoded for compatibility
Vitexus Oct 21, 2025
a3a3409
Add modernization and CI/CD setup for PHP 8.1+ support
Vitexus Oct 21, 2025
fed2e25
Add Debian packaging for FluentPDO with CI pipelines
Vitexus Oct 21, 2025
0c64750
composer vendor name update
Vitexus Oct 21, 2025
6d915bf
ci: sync debian/Jenkinsfile.release from reference
Oct 21, 2025
57f6174
Merge branch 'debianized'
Vitexus Oct 21, 2025
805a279
Debian postinst added
Vitexus Oct 21, 2025
69079ea
Adds fallback PDO drivers to dependencies
Vitexus Oct 21, 2025
c91a283
build deps update
Vitexus Oct 21, 2025
48076c7
deb deps update
Vitexus Oct 21, 2025
2ac4e26
deb package version fix
Vitexus Oct 22, 2025
5e6070d
Fix getIterator return type for PHP 8.1+ compatibility
Vitexus Oct 24, 2025
e5007dd
Fix str_starts_with type error with integer keys
Vitexus Oct 24, 2025
d72b5d0
Fix syntax error in buildParameters method
Vitexus Oct 24, 2025
158ba59
Debian packaging: Switch to pkg-php-tools
Vitexus Oct 25, 2025
2129d43
Updates dependencies and improves type annotations
Vitexus Dec 9, 2025
7bad8a7
ignore the .build directory contents
Vitexus Jan 7, 2026
f8b5d1d
Throws exception for invalid method calls
Vitexus Jan 7, 2026
de3f0e1
Update Query.php
Vitexus Jan 12, 2026
9c1e74e
Add AppStream metadata
Vitexus Jan 25, 2026
6f8fa13
build pipelines update
Vitexus Jan 26, 2026
5340bdc
chore: update package to version 3.0.4
Vitexus Feb 2, 2026
186c352
production pipeline update
Vitexus Mar 2, 2026
fc43c8b
Migrace na Debian PHP autoloader systém
Vitexus Mar 3, 2026
0021ce6
autoloader moved to debian dir
Vitexus Mar 5, 2026
eaf25f0
ci: update Jenkinsfile.release to use multiflexi build images
Vitexus Mar 11, 2026
4f6282f
fix: remove --ipc=host to prevent faked-sysv collision in parallel bu…
Vitexus Mar 13, 2026
5b284e7
fix: inject APP_NAME/APP_VERSION and populate Composer\InstalledVersi…
Vitexus Apr 20, 2026
1030df3
fix: read package name from composer.json for InstalledVersions identity
Vitexus Apr 21, 2026
a40fbf6
fix: write composer.json name into autoload.php at build time, no run…
Vitexus Apr 21, 2026
b0fe0ae
fix: InstalledVersions name always from composer.json, not APP_NAME
Vitexus Apr 21, 2026
bb278eb
fix: extract version from debian/changelog at build time, not runtime
Vitexus Apr 21, 2026
85a442f
fix: correct Makefile line continuation in sed injection (\\→\)
Vitexus Apr 21, 2026
0964051
fix: only composer type=project packages define APP_NAME/APP_VERSION
Vitexus Apr 21, 2026
1469e58
resolute build
Vitexus May 5, 2026
0f71ab3
pack fix
Vitexus May 5, 2026
f344bd0
fix: block build when RebulidDEBRepoByAnsible is running
Vitexus May 16, 2026
fa0fe28
fix: wait for RebulidDEBRepoByAnsible before apt test installation
Vitexus May 16, 2026
6c938b1
fix: block build when RebulidDEBRepoByAnsible is running
Vitexus May 16, 2026
4b76f92
build pipeline update
Vitexus May 17, 2026
b7a0746
fix: disable debian:forky build in Jenkinsfile(s)
Vitexus May 20, 2026
41233b5
refactor(debian): remove unstable forky distribution from Jenkinsfile…
Vitexus Jul 12, 2026
017a6e6
build(release): add global build blocker for package installation rac…
Vitexus Jul 12, 2026
2f41d6f
docs: Rename WARP.md to AGENTS.md for consistency
Vitexus Aug 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: VitexSoftware
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
43 changes: 43 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!-- Use this file to provide workspace-specific custom instructions to Copilot. For more details, visit https://code.visualstudio.com/docs/copilot/copilot-customization#_use-a-githubcopilotinstructionsmd-file -->

All code comments should be written in English.

All messages, including error messages, should be written in English.

All code should be written in PHP 8.4 or later.

All code should follow the PSR-12 coding standard.

When writing code, always include a docblock for functions and classes, describing their purpose, parameters, and return types.

When writing tests, use PHPUnit and follow the PSR-12 coding standard.

When writing documentation, use MarkDown format.

When writing commit messages, use the imperative mood and keep them concise.

When writing code comments, use complete sentences and proper grammar.

When writing code, always use meaningful variable names that describe their purpose.

When writing code, avoid using magic numbers or strings; instead, define constants for them.

When writing code, always handle exceptions properly and provide meaningful error messages.

When writing code, always include type hints for function parameters and return types.

We are using the i18n library for internationalization, so always use the _() functions for strings that need to be translated.

When writing code, always ensure that it is secure and does not expose any sensitive information.

When writing code, always consider performance and optimize where necessary.

When writing code, always ensure that it is compatible with the latest version of PHP and the libraries we are using.

When writing code, always ensure that it is well-tested and includes unit tests where applicable.

When writing code, always ensure that it is maintainable and follows best practices.

When create new class or update existing class, always create or update its phpunit test files.

After every single edit to a PHP file, always run `php -l` on the edited file to lint it and ensure code sanity before proceeding further. This is mandatory for all PHP code changes.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
versioning-strategy: increase
commit-message:
prefix: "composer"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
21 changes: 21 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: PHPUnit

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
env:
DEBIAN_FRONTEND: "noninteractive"
LC_ALL: "en_US.UTF-8"
LANG: "en_US.UTF-8"
- name: Prepare Environment
run: |
sudo apt-get install -y composer exim4
composer update
- name: Run tests
run: make phpunit
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
/.idea/
/vendor/
debian/php-vitexsoftware-fluentpdo.debhelper.log
debian/.debhelper/
debian/php-vitexsoftware-fluentpdo/
debian/debhelper-build-stamp
debian/php-vitexsoftware-fluentpdo.substvars
nbproject/
.build/
122 changes: 122 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php

declare(strict_types=1);

/**
* This file is part of the FluentPDO package.
*
* FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.
*
* For more information see readme.md
*
* @link https://github.com/VitexSoftware/fluentpdo
* @author Chris Bornhoft, start@env.ms
* @copyright 2012-2020 envms - Chris Bornhoft, Marek Lichtner
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License, version 3.0
*
* (G) 2025-2026 Vítězslav Dvořák <info@vitexsoftware.cz>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Ergebnis\PhpCsFixer\Config\Factory;
use Ergebnis\PhpCsFixer\Config\Rules;
use Ergebnis\PhpCsFixer\Config\RuleSet\Php81;

$header = <<<'HEADER'
This file is part of the FluentPDO package.

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

For more information see readme.md

@link https://github.com/VitexSoftware/fluentpdo
@author Chris Bornhoft, start@env.ms
@copyright 2012-2020 envms - Chris Bornhoft, Marek Lichtner
@license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License, version 3.0

(G) 2025-2026 Vítězslav Dvořák <info@vitexsoftware.cz>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
HEADER;

$ruleSet = Php81::create()->withHeader($header)->withRules(Rules::fromArray([
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'declare',
'default',
'do',
'exit',
'for',
'foreach',
'goto',
'if',
'include',
'include_once',
'require',
'require_once',
'return',
'switch',
'throw',
'try',
'while',
],
],
'concat_space' => [
'spacing' => 'none',
],
'date_time_immutable' => false,
'error_suppression' => false,
'final_class' => false,
'mb_str_functions' => false,
'native_function_invocation' => [
'exclude' => [
'sprintf',
],
'include' => [
'@compiler_optimized',
],
'scope' => 'all',
'strict' => false,
],
'php_unit_internal_class' => false,
'php_unit_test_annotation' => [
'style' => 'prefix',
],
'php_unit_test_class_requires_covers' => false,
'return_to_yield_from' => false,
'phpdoc_array_type' => false,
'phpdoc_list_type' => false,
'attribute_empty_parentheses' => false,
'final_public_method_for_abstract_class' => false,
'class_attributes_separation' => [
'elements' => [
'const' => 'only_if_meta',
'property' => 'only_if_meta',
'trait_import' => 'none',
'case' => 'none',
],
],
'yoda_style' => false,
'php_unit_test_case_static_method_calls' => false,
]));

$config = Factory::fromRuleSet($ruleSet)->setUnsupportedPhpVersionAllowed(true);

$config->getFinder()
->append([
__DIR__.'/.php-cs-fixer.dist.php',
])
->append([
__DIR__.'/rector.php',
])
->in('src')
->in('tests');

$config->setCacheFile(__DIR__.'/.build/php-cs-fixer/.php-cs-fixer.cache');

return $config;
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"php.version": "8.2",
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#225d9c",
"activityBar.background": "#225d9c",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#dd629d",
"activityBarBadge.foreground": "#15202b",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#225d9c",
"statusBar.background": "#194472",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#225d9c",
"statusBarItem.remoteBackground": "#194472",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#194472",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#19447299",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#194472"
}
99 changes: 99 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# AGENTS.md

This file provides guidance to WARP (warp.dev) when working with code in this repository.

## Project Overview

FluentPDO - PHP 8.1+ Edition is a modernized fork of the original FluentPDO project. It's a PHP SQL query builder library using PDO with a smart join builder that automatically creates table joins. This version (3.x) requires PHP 8.1+ and includes modern type declarations, strict typing, and enhanced features.

## Common Development Commands

### Testing
```bash
# Run all tests
phpunit --configuration phpunit.xml

# Install dependencies first if needed
composer install

# Set up test database (for local development)
mysql -u $DB_USER < tests/_resources/fluentdb.sql
```

### Development Setup
```bash
# Install dependencies
composer install

# For testing, you need a MySQL database named 'fluentdb'
# Check tests/_resources/init.php for database configuration
```

## Code Architecture

### Core Classes Structure
- `Query` - Main entry point, creates query objects (SELECT, INSERT, UPDATE, DELETE)
- `Structure` - Handles table relationships, primary/foreign key conventions
- `Base` - Abstract base class for all query types, handles execution and parameters
- `Common` - Shared functionality for SELECT/UPDATE/DELETE queries (WHERE, JOIN clauses)

### Query Types (src/Queries/)
- `Select` - SELECT query builder with smart joins, implements Countable
- `Insert` - INSERT query builder
- `Update` - UPDATE query builder
- `Delete` - DELETE query builder
- `Json` - JSON query support

### Key Features
- **Smart Join Builder**: Automatically creates JOINs based on column references (e.g., `user.name` auto-joins user table)
- **Fluent Interface**: Method chaining for building queries
- **PDO Integration**: Built on top of PDO for database portability
- **Type Conversion**: Optional type conversion for read/write operations

### Database Conventions
- Primary keys default to 'id'
- Foreign keys follow pattern '%s_id' (e.g., `user_id` for user table)
- These conventions can be customized via `Structure` class

### Usage Patterns
```php
// Basic setup
$fluent = new \Envms\FluentPDO\Query($pdo);

// Smart joins automatically created
$query = $fluent->from('comment')
->where('article.published_at > ?', $date) // Auto-joins article table
->orderBy('published_at DESC');

// Shorthand methods for single-row operations
$user = $fluent->from('user', 1)->fetch(); // WHERE id = 1
$fluent->update('article', $data, 1)->execute(); // WHERE id = 1
```

## Testing Environment

Tests use MySQL with database 'fluentdb'. Test configuration:
- Travis CI: Uses root user with no password
- Local development: Uses 'vagrant'/'vagrant' credentials
- Database schema: `tests/_resources/fluentdb.sql`
- Test initialization: `tests/_resources/init.php`

## Development Notes

- **Modern PHP 8.1+**: This fork requires PHP 8.1+ with strict typing throughout
- **Type Safety**: All classes use `declare(strict_types=1)` and proper type declarations
- **Array Handling**: Arrays are automatically converted to JSON strings for database storage
- **Union Types**: Uses modern PHP union types where appropriate (e.g., `mixed`, `string|null`)
- **PSR-4 Autoloading**: Namespace remains `Envms\FluentPDO` for compatibility
- **Iterator Support**: All query builders implement `IteratorAggregate` for direct iteration
- **Debugging**: Debug mode available via `$fluent->debug` property (mixed type)
- **Error Handling**: Exception handling configurable via `exceptionOnError` property
- **Fetch Modes**: Supports both object and array fetch modes with enhanced type safety

## Fork Information

This is a modernized fork of [envms/fluentpdo](https://github.com/envms/fluentpdo) (inactive since 2021). Changes include:
- PHP 8.1+ compatibility with modern type system
- Fixed array parameter handling (JSON serialization)
- Enhanced IDE support with proper type hints
- Updated development dependencies and tools
Loading