Skip to content

Instantly share code, notes, and snippets.

@nmfzone
Last active July 29, 2022 15:42
Show Gist options
  • Save nmfzone/19a277096ed4be9aa8cd25424075d797 to your computer and use it in GitHub Desktop.
Save nmfzone/19a277096ed4be9aa8cd25424075d797 to your computer and use it in GitHub Desktop.
Intellij IDEA Laravel Configuration
<?xml version="1.0"?>
<ruleset name="Laravel Code Standard" namespace="Laravel\CS\Standard">
<description>Code Standard used for Laravel App</description>
<file>./app</file>
<file>./routes</file>
<exclude-pattern>./bootstrap/*</exclude-pattern>
<exclude-pattern>./config/*</exclude-pattern>
<exclude-pattern>./database/*</exclude-pattern>
<exclude-pattern>./resources/*</exclude-pattern>
<exclude-pattern>./storage/*</exclude-pattern>
<exclude-pattern>./tests/*</exclude-pattern>
<exclude-pattern>./vendor/*</exclude-pattern>
<arg name="colors"/>
<rule ref="PSR2" />
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="110" />
<property name="absoluteLineLimit" value="110" />
</properties>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="true" />
</properties>
</rule>
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array"
value="session_start=>NULL,
$_SESSION=>session,
$_POST=>request,
$_GET=>request,
eval=>NULL,
dd=>NULL,
var_dump=>NULL,
sizeof=>count,
delete=>unset" />
</properties>
</rule>
<rule ref="Squiz.PHP.CommentedOutCode">
<properties>
<property name="maxPercentage" value="75" />
</properties>
</rule>
</ruleset>
path: ./
jobs: 10
cache: phplint.cache
extensions:
- php
exclude:
- bootstrap
- public
- storage
- tests
- vendor
<!--
########## DO NOT INCLUDE THIS ##########
# File Location: ~/project_dir/.idea/codeStyles/Project.xml
#########################################
-->
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JSCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</JSCodeStyleSettings>
<PHPCodeStyleSettings>
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="false" />
<option name="PHPDOC_WRAP_LONG_LINES" value="true" />
<option name="PHPDOC_PARAM_SPACES_BETWEEN_TAG_AND_TYPE" value="2" />
<option name="PHPDOC_PARAM_SPACES_BETWEEN_TYPE_AND_NAME" value="2" />
<option name="PHPDOC_PARAM_SPACES_BETWEEN_NAME_AND_DESCRIPTION" value="2" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="ELSE_IF_STYLE" value="COMBINE" />
<option name="KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE" value="true" />
<option name="SPACE_AFTER_UNARY_NOT" value="true" />
<option name="SPACE_BEFORE_SHORT_CLOSURE_LEFT_PARENTHESIS" value="true" />
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
<option name="PHPDOC_USE_FQCN" value="true" />
</PHPCodeStyleSettings>
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
<TypeScriptCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
<option name="BLACKLIST_IMPORTS" value="rxjs/Rx" />
</TypeScriptCodeStyleSettings>
<codeStyleSettings language="Blade">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="false" />
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="RIGHT_MARGIN" value="120" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="false" />
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
paths:
- app
level: 5
ignoreErrors:
- '#Method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_]+() should return [a-zA-Z|]+|null but return statement is missing#'
- '#Call to an undefined method Illuminate\Auth\AuthManager::login()#'
excludes_analyse:
- bootstrap/
- config/
- database/
- public/
- resources/
- routes/
- storage/
- tests/
- vendor/
########## DO NOT INCLUDE THIS ##########
# File Location: ~/project_dir/.git/hooks/pre-commit
#########################################
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".php\{0,1\}$")
IFS=' ' STAGED_FILES=($STAGED_FILES)
for i in "${!STAGED_FILES[@]}"; do
if ! [[ ${STAGED_FILES[$i]} =~ (/|\\) ]]; then
# filter root files
# all of the tools below lack of filtering files in the root
unset STAGED_FILES[$i]
fi
done
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
echo "\nFinding PHPCS installation:"
# Check for phpcs installation
which ./vendor/bin/phpcs &> /dev/null
if [[ "$?" == 1 ]]; then
echo "\t\033[41m Please install PHPCS! \033[0m"
exit 1
fi
echo "\033[30;42m Found PHPCS installation \033[0m\n"
echo "Finding larastan installation:"
# Check for larastan installation
which ./vendor/bin/phpstan &> /dev/null
if [[ "$?" == 1 ]]; then
echo "\t\033[41m Please install Larastan (composer require nunomaduro/larastan --dev)! \033[0m"
exit 1
fi
echo "\033[30;42m Found larastan installation \033[0m\n"
echo "Finding PHPLint installation:"
# Check for phplint installation
which ./vendor/bin/phplint &> /dev/null
if [[ "$?" == 1 ]]; then
echo "\t\033[41m Please install PHPLint (composer require overtrue/phplint --dev)! \033[0m"
exit 1
fi
echo "\033[30;42m Found phplint installation \033[0m\n"
echo "\033[30;43m PHPCS: Analysing code \033[0m"
./vendor/bin/phpcs --standard="./.phpcs.xml" $STAGED_FILES
if [[ "$?" != 0 ]]; then
PASS=false
fi
if $PASS; then
echo "\033[30;42m PHPCS: Pass \033[0m"
echo "\n\033[30;43m Larastan: Analysing code \033[0m\n"
./vendor/bin/phpstan analyse --no-progress $STAGED_FILES
if [[ "$?" != 0 ]]; then
PASS=false
fi
fi
if $PASS; then
echo "\033[30;42m Larastan: Pass \033[0m"
echo "\n\033[30;43m PHPLint: Linting code \033[0m\n"
./vendor/bin/phplint --configuration="./.phplint.yml" $STAGED_FILES
if [[ "$?" != 0 ]]; then
PASS=false
fi
if $PASS; then
echo "\033[30;42m PHPLint: Pass \033[0m"
fi
fi
if ! $PASS; then
echo "\n\033[41m COMMIT FAILED \033[0m\n"
echo "Your commit contains files that should pass code standard but do not.\nPlease fix the errors and try again."
exit 1
else
echo "\n\033[30;42m COMMIT SUCCEEDED \033[0m\n"
fi
exit $?
<!--
########## DO NOT INCLUDE THIS ##########
# File Location: ~/project_dir/.idea/inspectionProfiles/Project_Default.xml
#########################################
-->
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="CheckEmptyScriptTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="HtmlUnknownTag" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myValues">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="NpmUsedModulesInstalled" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PhpCSFixerValidationInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="CODING_STANDARD" value="Custom" />
<option name="CUSTOM_RULESET_PATH" value="$PROJECT_DIR$/.php_cs" />
</inspection_tool>
<inspection_tool class="PhpCSValidationInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false">
<option name="EXTENSIONS" value="php,js,css,inc" />
</inspection_tool>
<inspection_tool class="PhpFullyQualifiedNameUsageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUndefinedClassInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="DONT_REPORT_MULTI_RESOLVE" value="true" />
</inspection_tool>
<inspection_tool class="PhpUndefinedFieldInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUnhandledExceptionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUnnecessaryFullyQualifiedNameInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUnused" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>
@nmfzone
Copy link
Author

nmfzone commented Apr 26, 2020

Install Development tools:

$ composer require barryvdh/laravel-debugbar --dev

@nmfzone
Copy link
Author

nmfzone commented Apr 26, 2020

Install good package:

$ composer require laravel/telescope fntneves/laravel-transactional-events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment