Welcome Guest, Not a member yet? Register   Sign In
Atom PHP Environment + CodeIgniter 3 & 4
#1
Lightbulb 
(This post was last modified: 05-17-2017, 04:39 PM by natanfelles. Edit Reason: Add images )

Gist: Atom PHP Environment + CodeIgniter 3 & 4


Atom PHP Environment + CodeIgniter 3 & 4
For Debian based distros (Ubuntu, Linux Mint...)
[Image: atom.png]


Download and install Atom:

Code:
cd ~/Downloads
wget https://github.com/atom/atom/releases/download/v1.15.0/atom-amd64.deb
sudo dpkg -i atom-amd64.deb

Install required SO packages:

Code:
sudo apt install php php-sqlite3 php-mbstring sqlite3 composer npm


Code Formatters

atom-beautify uses JS Beautify by default.

Code:
sudo npm -g install js-beautify
apm install atom-beautify


For PHP, atom-beautify uses php-cs-fixer by default but it do not worked for me, then we can install phpcbf.

Code:
composer global require friendsofphp/php-cs-fixer
composer global require squizlabs/php_codesniffer


After, go to Atom and open the menu Edit > Preferences > Packages, go to atom-beautify and edit the PHP Settings and set Default Beautifier to PHPCBF and PHPCBF Standard put PSR2.

Linters

Code:
sudo npm -g install linter
sudo npm -g install htmlhint
sudo npm -g install csslint
sudo npm -g install jshint

apm install linter
apm install linter-htmlhint
apm install linter-csslint
apm install linter-jshint


The Awesome

PHP Integrator is a powerful project that provides code analysis and utilities for PHP projects.

PHP Integrator uses composer to install the core and you need install the correct version corresponding to the php-integrator-base version.

Code:
composer global require php-integrator/core 2.1.1


PHP Integrator also uses the project-manager to activate resources based by project.

Lets install the Atom packages:

Code:
apm install project-manager
apm install php-integrator-base
apm install php-integrator-linter
apm install php-integrator-annotations
apm install php-integrator-autocomplete-plus
apm install php-integrator-call-tips
apm install php-integrator-navigation
apm install php-integrator-tooltips
apm install php-integrator-refactoring


CodeIgniter

[Image: atom-codeigniter.png]


When you works on a CodeIgniter 3 project you can download this file https://raw.githubusercontent.com/natanf...pstorm.php inside your project root.

After go to Atom and open the menu Packages > Project Manager > Edit Projects and configure your project like it:

Code:
{
 title: "CodeIgniter 3"
 paths: [
   "/home/username/codeigniter3"
 ]
 icon: "icon-flame"
 devMode: false
 php:
   enabled: true
   php_integrator:
     enabled: true
     phpVersion: 5.6
     excludedPaths: [
         "{0}/application/cache/",
         "{0}/application/logs/",
         "{0}/system/core/Controller.php",
         "{0}/system/core/Model.php"
     ]
     fileExtensions: [
       "php"
     ]
}


This tip will do PHP Integrator do not read Controller.php and Model.php from the system folder, then it will use all the @property from phpstorm.php file.

You can read more about it in Code Completion for CodeIgniter in phpStorm and here Excluding Folders From Indexing.

Big Grin  On CodeIgniter 4 you can not need do this config. PHP Integrator will works nice natively.

Extras

Some extra packages that I like:

Code:
apm install atom-ternjs
apm install color-picker
apm install pigments
apm install git-plus
apm install docblockr
apm install bootstrap3-snippets
apm install file-icons
apm install editorconfig
apm install todo-show
apm install highlight-selected
apm install emmet
apm install minimap
apm install language-htaccess
apm install language-markdown
apm install linter-write-good
apm install linter-json-lint
apm install api-docs
apm install sync-settings
Reply
#2

Interesting stuff.
There are those who tell lies with meaning behind them and those meaning less lies!
Reply
#3

Thanks for this. I was looking into Atom recently because I like the idea of it and was looking for a potential change from PHPStorm, but hadn't found the tools that might allow me to take care of most of the stuff I was used to having. The PHP Integrator project might be just what I was looking for. Time to play a little. Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB