Skip to content
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

V2 - PHP Binary Helper #127

Merged
merged 34 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bbd037a
Config directory migrate
uttamrabadiya May 1, 2024
12993c4
PHP bash binary support
uttamrabadiya May 1, 2024
06d1556
Fixed valet share command
uttamrabadiya May 3, 2024
e31819e
Preparing Unit test structure
uttamrabadiya May 3, 2024
e3ccc36
Removed extra config
uttamrabadiya May 3, 2024
14977d2
Added unit test and minor improvements
uttamrabadiya May 4, 2024
1312f40
added unit test
uttamrabadiya May 4, 2024
2d3b6fa
added unit test
uttamrabadiya May 6, 2024
e556fc5
Removed using which-php command for php helper binary
uttamrabadiya May 6, 2024
9fe4cd3
fixed unit test
uttamrabadiya May 6, 2024
feab188
fixed bash file to work with blank isolated array
uttamrabadiya May 6, 2024
b190348
fix
uttamrabadiya May 6, 2024
b804856
Fixed DevTools class
uttamrabadiya May 12, 2024
91cb524
removed file
uttamrabadiya May 12, 2024
34616a7
Added coverage report config
uttamrabadiya May 12, 2024
25214d9
Added Unit test for Mailpit test
uttamrabadiya May 12, 2024
37944d0
Added Unit test for Ngrok
uttamrabadiya May 14, 2024
773ca34
Added Unit test for Mysql
uttamrabadiya May 14, 2024
1fa8f47
added unit tests for nginx, ngrok & requirements
uttamrabadiya May 15, 2024
6e7f975
Added Unit test for PhpFpm
uttamrabadiya May 18, 2024
faf8871
Added Unit tests
uttamrabadiya May 18, 2024
d32c3b6
Added Unit tests
uttamrabadiya May 23, 2024
7b5b6bf
Added unit test
uttamrabadiya May 24, 2024
ba51599
fix
uttamrabadiya May 24, 2024
aceeea0
fix
uttamrabadiya May 24, 2024
7285338
fix
uttamrabadiya May 24, 2024
7dfa534
fix
uttamrabadiya May 24, 2024
5e6d1cd
fix
uttamrabadiya May 24, 2024
2392e79
fix
uttamrabadiya May 24, 2024
f16b8e9
fix
uttamrabadiya May 24, 2024
79bc875
fix
uttamrabadiya May 24, 2024
3ca4d94
Added unit test
uttamrabadiya May 24, 2024
b049a70
fix
uttamrabadiya May 24, 2024
1870326
Refactored Site class
uttamrabadiya Jun 2, 2024
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
31 changes: 25 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: CI-Ubuntu
name: CI

on: [pull_request]

jobs:
build:
name: Build & Test on Ubuntu 22.04
test:
name: Build & Test
runs-on: ubuntu-22.04
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master'
strategy:
matrix:
php:
- 8.0
- 8.1
- 8.2
- 8.3
steps:
- uses: actions/checkout@v2
- name: Set up PHP
Expand All @@ -25,3 +24,23 @@ jobs:
composer install --no-interaction --prefer-dist
- name: Test
run: vendor/bin/phpunit
cs_fixer:
name: CS Fixer
runs-on: ubuntu-22.04
strategy:
matrix:
php:
- 8.3
steps:
- uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y network-manager libnss3-tools jq xsel
composer install --no-interaction --prefer-dist
- name: CS Fixer
run: vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
vendor/
bin/
tests/config
composer.lock
error.log
*.sublime-project
*.sublime-workspace
psysh
Gemfile
Gemfile.lock
_site/
.idea
/.php-cs-fixer.cache
.php-cs-fixer.cache
.phpunit.result.cache
56 changes: 56 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in([
__DIR__.'/cli/',
__DIR__.'/tests/'
]);

$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setUsingCache(false)
->setRules([
'@PSR12' => true,
'list_syntax' => ['syntax' => 'short'],
'multiline_comment_opening_closing' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_spaces_after_function_name' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['class', 'function', 'const']],
'php_unit_construct' => true,
'php_unit_expectation' => true,
'php_unit_mock' => ['target' => 'newest'],
'php_unit_mock_short_will_return' => true,
'php_unit_no_expectation_annotation' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_line_span' => ['method' => 'multi', 'property' => 'multi'],
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_scalar' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true,
'phpdoc_var_annotation_correct_order' => true,
'phpdoc_var_without_name' => true,
'protected_to_private' => true,
'return_assignment' => true,
'short_scalar_cast' => true,
'single_trait_insert_per_statement' => true,
'standardize_not_equals' => true,
'trim_array_spaces' => true,
'visibility_required' => ['elements' => ['const']],
'whitespace_after_comma_in_array' => true,
])
->setFinder($finder);
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<p align="center"><img width="500" src="art/logo.png"></p>

<p align="center">
<a href="https://github.styleci.io/repos/218757845"><img src="https://github.styleci.io/repos/218757845/shield?branch=master" alt="StyleCI"></a>
<a href="https://scrutinizer-ci.com/g/genesisweb/valet-linux-plus/?branch=master"><img src="https://scrutinizer-ci.com/g/genesisweb/valet-linux-plus/badges/quality-score.png?b=master" alt="Scrutinizer"></a>
<a href="https://packagist.org/packages/genesisweb/valet-linux-plus"><img src="https://poser.pugx.org/genesisweb/valet-linux-plus/downloads.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/genesisweb/valet-linux-plus"><img src="https://poser.pugx.org/genesisweb/valet-linux-plus/v/stable.svg" alt="Latest Stable Version"></a>
Expand Down
40 changes: 27 additions & 13 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
1. Finish refactoring classes in Valet directory -- Done
2. Fix facade.php -- Done
3. Move config directory from ~/.valet to ~/.config/valet
3.1 Copy directory from ~/.valet to ~/.config
3.2 Replace /home/uttam/.valet path with /home/uttam/.config/valet for Nginx directory files (Logs & Certificate, .sock files)
3.3 Replace .sock file paths in valet.conf file.
3.4 Regenerate symbolic links in Sites directory
4. Add relevant test cases
5. Enable Phpstan & CodeSniffer -- Done
6. Enable unit coverage report
7. Add Infection
8. Ngrok remove binary file and install it via `valet install` command
9. self-signed certificate verification issues in Firefox & PHP's curl requests
Remain Items:
- Enable unit coverage report
- Add Infection
- Valet php extension install separately so that if not installed we can install it via valet install command. (Optional)
- Improve valet uninstall experience
- User should be able to select which services they want to uninstall
- mbstring extension was not installed in system, but composer install command fail to stop process as it was mentioned in required json


Done Items:
- Implement termwind -- Done
- Fix extra messages (Fixing, already enabled, restarting) -- Done
- Remove was already enabled message -- Done
- Enable Phpstan & CodeSniffer -- Done
- Finish refactoring classes in Valet directory -- Done
- Fix facade.php -- Done
- Move config directory from ~/.valet to ~/.config/valet -- Done
- Update valet use command to only work with current supported PHP versions
- Update valet isolate command to work with every php version from 7.0 to latest
- Optimise php bash file to handle blank output of which-php command
- self-signed certificate verification issues in Firefox & PHP's curl requests -- Done
- Ngrok remove binary file and install it via `valet install` command
- Optimise PHP Bash file to not relay on which-php command
- It should read fallback version from ~/.config/valet/config.json file
- It should read isolated version for directory from ~/.config/valet/config.json file
- Add relevant test cases
-
14 changes: 3 additions & 11 deletions cli/Valet/CommandLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,13 @@ public function runAsUser(string $command, callable $onError = null): string

/**
* Run the given command.
* TODO: Refactor new Process instance, we might not need if statement there.
*/
private function runCommand(string $command, callable $onError = null): string
{
$onError = $onError ?: function () {};
$onError = $onError ?: function () {
};

// Symfony's 4.x Process component has deprecated passing a command string
// to the constructor, but older versions (which Valet's Composer
// constraints allow) don't have the fromShellCommandLine method.
// For more information, see: https://github.com/laravel/valet/pull/761
if (method_exists(Process::class, 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command);
} else {
$process = new Process($command);
}
$process = Process::fromShellCommandline($command);

$processOutput = '';
$process->setTimeout(null)->run(function ($type, $line) use (&$processOutput) {
Expand Down
Loading
Loading