-
Notifications
You must be signed in to change notification settings - Fork 259
build: Add PHP binding #1860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
build: Add PHP binding #1860
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
987142f
Update README.md
vanillajonathan fad594d
Create php.md
vanillajonathan c24435d
Create .gitignore
vanillajonathan 4378fb7
Add files via upload
vanillajonathan e88275f
Update composer.json
vanillajonathan 90facac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 358adb7
Update composer.json
vanillajonathan 60dd7af
Update Compiler.php
vanillajonathan acb0686
Update prql-php/.gitignore
vanillajonathan ef37369
Merge branch 'main' into patch-1
vanillajonathan cff81ac
Add composer lock file
vanillajonathan a44ef7a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 68feb33
Merge branch 'PRQL:main' into patch-1
vanillajonathan c39b948
Create test-php.yaml
vanillajonathan 604ccf3
Update test-php.yaml
vanillajonathan c381fea
Update test-php.yaml
vanillajonathan f554472
Update composer.json
vanillajonathan e7790b1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6fed448
Update composer.json
vanillajonathan e9e9b0c
Update test-php.yaml
vanillajonathan 035283d
Update test-php.yaml
vanillajonathan 7ffb9e9
Update test-php.yaml
vanillajonathan 5560ef4
Update test-php.yaml
vanillajonathan 272facb
Update test-php.yaml
vanillajonathan 2f6a8a1
Uncomment unit tests
vanillajonathan 8ed7aa2
Pass test dir as args
vanillajonathan 715955f
Bootstrap the autoloader
vanillajonathan f112241
Build library and copy library file
vanillajonathan 15f7fd8
Update test-php.yaml
vanillajonathan d2ce386
Update test-php.yaml
vanillajonathan 4b0470b
Update test-php.yaml
vanillajonathan e2878cd
Update test-php.yaml
vanillajonathan 86a34b0
Update test-php.yaml
vanillajonathan dd23e2a
Update test-php.yaml
vanillajonathan 44f77cb
Update test-php.yaml
vanillajonathan 3db2a06
Add more unit tests
vanillajonathan 8813bb2
Update CompilerTest.php
vanillajonathan 5637195
Update test-php.yaml
vanillajonathan 1386d7a
Update CompilerTest.php
vanillajonathan d436e7d
Update test-php.yaml
vanillajonathan cea7839
Merge branch 'main' into patch-1
max-sixty d9732dc
Add test-php
vanillajonathan 3d0bdd1
Add concurrency thing
vanillajonathan 385dd5c
Remove php-actions/phpunit
vanillajonathan 47e925f
Update .github/workflows/test-php.yaml
max-sixty 45c952c
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: test-php | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "prql-php/**" | ||
| - ".github/workflows/test-php.yaml" | ||
| workflow_call: | ||
|
|
||
| concurrency: | ||
| # See notes in `pull-request.yaml` | ||
| group: ${{ github.workflow }}-${{ github.ref }}-php | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest] | ||
| steps: | ||
| - name: 📂 Checkout code | ||
| uses: actions/checkout@v3 | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| - run: cargo build | ||
| working-directory: prql-lib | ||
| - run: | | ||
| mv ../target/debug/libprql_lib.so ../prql-php/src/libprql_lib.so | ||
| ls -l ../target/debug/ | ||
| uname -a | ||
| ls -lR ../prql-php/ | ||
| working-directory: prql-lib | ||
| - name: 📦 Install dependencies using Composer | ||
| uses: php-actions/composer@v6 | ||
| with: | ||
| args: --working-dir=prql-php | ||
| php_extensions: FFI | ||
| - name: 🧪 Run tests using PHPUnit | ||
| run: vendor/bin/phpunit tests | ||
| working-directory: prql-php | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {{#include ../../../prql-php/README.md}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /vendor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # prql-php | ||
|
|
||
| `prql-php` offers PHP bindings through FFI. | ||
|
|
||
| It provides the `Compiler` class which contains the `toJson` and `toSql` | ||
max-sixty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| methods. | ||
|
|
||
| It's still at an early stage, and isn't published to Composer. Contributions are | ||
| welcome. | ||
|
|
||
| ## Installation | ||
|
|
||
| The [PHP FFI extension](https://www.php.net/manual/en/book.ffi.php) needs to be | ||
| enabled. Set `ffi.enable` in your php.ini configuration file to `"true"`. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```php | ||
| <?php | ||
|
|
||
| use Prql\Compiler\Compiler; | ||
|
|
||
| $prql = new Compiler(); | ||
| $result = $prql->toSql("from employees"); | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "name": "prql/compiler", | ||
| "description": "PRQL compiler bindings.", | ||
| "keywords": [ | ||
| "prql", | ||
| "sql" | ||
| ], | ||
| "homepage": "https://prql-lang.org/", | ||
| "type": "library", | ||
| "license": "Apache-2.0", | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Prql\\Compiler\\": "src/" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "Prql\\Tests\\": "tests/" | ||
| } | ||
| }, | ||
| "authors": [ | ||
| { | ||
| "name": "Jonathan" | ||
| } | ||
| ], | ||
| "support": { | ||
| "issues": "https://github.com/PRQL/prql/issues", | ||
| "source": "https://github.com/PRQL/prql", | ||
| "docs": "https://prql-lang.org/book/" | ||
| }, | ||
| "require": { | ||
| "ext-ffi": "*" | ||
| }, | ||
| "require-dev": { | ||
| "phpunit/phpunit": "^10" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.