Build Tools and Editors

Composer

https://getcomposer.org/doc/01-basic-usage.md

Wenn composer.json vorhanden, dann installiere dependencies mit:

composer update

PHPloy

https://github.com/banago/PHPloy

phploy.bat -s dev -l 

PHP-Intelephense

Sublime Text and VSCode

Turn off Intelephense-ls and phpls

If custom classes are not being expanded or recognized, make sure to declare public variables:


class class1
{
    public function function1()
    
{

    }
}

class class2
{
    /**
     * Make it available via autocomplete
     * @var myclass1;
     */

    public $myclass1;

    public function function2()
    
{
        $this->myclass1 = new class1;
        $this->myclass1->function1();
    }
}

$myclass2 = new class2;
$myclass2->function2();

Intelephense go to definition not working for custom php framework : vscode

If not only class methods are being presented, but all php methods, turn builtin php autocomplete off.

You must disable the vscode built-in PHP Language Features.

  1. Click extensions.
  2. In the search bar type @builtin php.
  3. Click cog icon of PHP Language Features.
  4. Click Disable.

https://stackoverflow.com/a/56879572/814031

PHPCS

https://benmatselby.dev/sublime-phpcs

Sublime Text

*.sublime-project

{
    "folders":
    [
        {
            "path": "E:\\WEB\\@docs"
        },
        {
            "path": ".",
            // hide in sidebar
            "file_exclude_patterns": ["*.7z", "*.psd", "*.mvp", "*.zip", "*.flac","*.mp3","*.mp4"]
        }
    ],
    "settings":
    {
        "phpcs":
        {
            //"phpcs_additional_args":
            //{
            //  "--standard": "/path/to/.composer/vendor/drupal/coder/coder_sniffer/Drupal"
            //},
            "phpcbf_additional_args":
            {
                "--standard": ".php_cs"
            }
        }
    }
}

Grunt

Performance Booster:

Boilerplate

package.json

{
    "name": "boilerplate",
    "version": "0.0.0",
    "description": "boilerplate",
    "author": "Marcus Obst <info@marcus-obst.de>",
    "private": true,
    "devDependencies": {

        // -- basic
        "grunt": "^0.4.5",
        "matchdep": "^0.3.0",
        "grunt-contrib-watch": "^0.6.1",
        "grunt-newer": "^1.1.1",            // only load new stuff
        "jit-grunt": "^0.9.1",              // just in time
        "time-grunt": "^1.2.1",             // benchmark


        // -- project
        "grunt-contrib-clean": "^0.6.0",    // empty directories
        "grunt-contrib-cssmin": "^0.13.0",  // minify css
        "grunt-contrib-imagemin": "^0.9.2", // minify images
        "grunt-contrib-jade": "^0.15.0",    // jade templates
        "grunt-contrib-less": "^1.0.0",     // less css compiler
        "grunt-cssbeautifier": "^0.1.2",    // beautify css
        "grunt-postcss": "^0.6.0",          // css processor plugins like autoprefixer
        "grunt-processhtml": "^0.3.8",      // inlines stuff, rewrites paths
        "grunt-stripmq": "0.0.6",           // remove mediaqueries for ie
        "grunt-uncss": "^0.4.3",            // remove unused css
    }
}

gruntfile.js


module.exports = function (grunt) {

    require('time-grunt')(grunt);
    // just in time grunt
    require('jit-grunt')(grunt);

    //require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);

    // the task configurations
    var BUILD_DIR = 'html/';


    // -- Init
    grunt.initConfig({

        // ---- Vars
        pkg: grunt.file.readJSON('package.json'),

        template_path: "html/template/style",

        // ---- Tasks
        watch: {
            options: {
                spawn: false,
            },
            less: {
                files:['<%= template_path %>/less/*.less'],
                tasks:['newer:less:development','newer:postcss','cssmin','stripmq']
            }
        },

    });

    // -- Watch Event
    grunt.event.on('watch', function(action, filepath, target) {
        grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
    });

    // -- Register Task
    grunt.registerTask('default', []);

};

Webpack

PHP Build in server

Via "Senden an" Kontextmenü kann eine Datei mit dem PHP Build In Server geöffnet werden.

open-on-localhost.cmd

@echo off

set input=%1
set root=E:\WEB\
Echo.Input was - %input%
set converted=%input:E:\WEB\=http://localhost:8000/%
set converted=%converted:\=/%
echo.Converted to - %converted%

start php -S localhost:8000 -t "E:\WEB\"

start %converted%