Configuring your dev environment to be able to use xdebug when you're working on Windows 10 (with WSL2) and Docker with VS Code can be (a bit) tricky.
This is a quick reminder of how I've done that.
- Install and configure xdebug in Docker
| <?php | |
| namespace Tests; | |
| use Illuminate\Contracts\Auth\Authenticatable; | |
| use Illuminate\Foundation\Http\FormRequest; | |
| use Illuminate\Validation\ValidationException; | |
| use Illuminate\Validation\Validator; | |
| use Symfony\Component\HttpFoundation\ParameterBag; | |
| use function PHPUnit\Framework\assertFalse; |
| name: CI/CD workflow | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| testing: |
Configuring your dev environment to be able to use xdebug when you're working on Windows 10 (with WSL2) and Docker with VS Code can be (a bit) tricky.
This is a quick reminder of how I've done that.
| <?php | |
| // don't show Event cost when 'free' or not set. | |
| add_filter ('tribe_get_cost', function($cost) { | |
| if ( strpos($cost, 'Free - ') !== false ) { | |
| return str_replace('Free - ', '', $cost); | |
| } | |
| return ( $cost === 0 || $cost === 'Free' ) ? '' : $cost; |
| <?php | |
| use PhpCsFixer\Config; | |
| use PhpCsFixer\Finder; | |
| $rules = [ | |
| 'array_indentation' => true, | |
| 'array_syntax' => ['syntax' => 'short'], | |
| 'binary_operator_spaces' => [ | |
| 'default' => 'single_space', |
| <?php | |
| $db_con = mysqli_connect("localhost", "username", "password", "database"); | |
| $result = $db_con->query('SELECT * FROM some_table'); | |
| if (!$result) die('Couldn\'t fetch records'); | |
| $num_fields = mysqli_num_fields($result); | |
| $headers = array(); | |
| while ($fieldinfo = mysqli_fetch_field($result)) { | |
| $headers[] = $fieldinfo->name; | |
| } | |
| $fp = fopen('php://output', 'w'); |