PHP Quick Code

Action Command
CONSTANSTS // Get list of defined constants.
get_defined_constants()
BUILT-IN SERVER // PHP Built-in Development Server
// Open terminal and run below commands.

cd path/to/php-project
cd php -S localhost:8080

// It shall out put -
PHP 7.3.11 Development Server started at Tue Jun 10 12:30:33 2020
Listening on http://localhost:8080

Now, check 'localhost:8000' in browser
PHP.NET // Download full php.net for offline use.
PHP.NET Offline

Comments

  1. Find loaded php.ini file location
    php --ini

    ReplyDelete
  2. Get PHP configuration loaded config (generally, /etc)
    php -i | grep ini

    If it outputs /etc and there is no php.ini, then make a copy of example /etc/php.ini.default
    sudo cp /etc/php.ini.default /etc/php.ini

    Update permission & file php.ini
    sudo chmod 664 /etc/php.ini
    vim /etc/php.ini

    ReplyDelete
  3. # PHP Modules
    sudo apt-get install php7.2-zip

    # Find php.ini
    In PHP info check, and update accordingly
    Configuration File (php.ini) Path
    /etc/php/7.2/fpm

    sudo vim /etc/php/7.2/fpm/php.ini
    sudo service php7.2-fpm restart
    OR

    sudo vim /etc/php/7.2/apache2/php.ini



    ReplyDelete
  4. Encapsulation hides the internal state or the information
    Abstraction hides the actual implementation

    ReplyDelete
  5. Encapsulation is a technique used to protect the state of an object from outside interference and misuse by bundling the data (attributes) and the methods (functions) that operate on the data into a single unit, which is the object.

    ReplyDelete
  6. Polymorphism means "many shapes" in Greek. It allows objects of different classes to be treated as objects of a common super class. It's like having the ability to call the zoo animals by a group name like "animal" and still having them respond with their specific behavior when it's feeding time.

    ReplyDelete

Post a Comment

Drupal Contribution
Git Commands
RESTful Services
Lando Commands
Docker Commands
MySQL
Database Quick Code
Drush Commands
Drupal Console
PHP Quick Code
Drupal Quick Code
Composer Commands
Linux Commands
Linux Shell Scripting
Drupal Hooks
Twig Tricks
PHPUnit Test
PhpMyAdmin
Drupal Constants
CSS Clues
BLT Commands
Vagrant Commands
Localhost
127.0.0.1
Drupal Interview
Drupal Certifications
Concept & Definitions
Mac Tips
Windows Tips
Browser Tips

Best Practice

Use 'elseif' instead of 'else if'
#CodingTips

As of PHP 5.4 you can also use the short array syntax, which replaces array() with []
#CodingTips

Functions in general shall be named using snake_case(say, my_function()), and using camelCase(say, myFunction()) when declared within a plugin class
#CodingTips

Variables in general shall be named using snake_case(say, $my_variable), and using camelCase(say, $myVariable) when declared within a plugin class
#CodingTips

Manage automatically assigning of new permissions whenever a module is enabled here- admin/config/people/accounts
#ConfigurationTips

Manage source of Main-menu and User-menu links here- admin/structure/menu/settings
#ConfigurationTips

Helper function(s) shall be named prefixing an underscore(say, _my_helper_function()), which can prevent hooks from being called
#CodingTips

Ideally, configuring of 'Private file system path' at admin/config/media/file-system should be located outside of your Drupal root folder(say, ../my_private_files)
#ConfigurationTips

You should be aware that uploading files as 'Private file' will slow down the process of loading the files as Drupal has to be bootstrapped for every file that needs to be downloaded
#ConfigurationTips #BeAware

Code should always be pushed up(dev -> staging -> production) and databases should only be pushed down(production -> staging -> dev)
#DevelopmentTips

Get Raw SQL Query of drupal dynamic queries before executing it using $query->__toString();
#DebugTips

In VI-Editor, Press ESC key to come in command mode and for undo type :U and for redo type :Ctrl+R
#LinuxTips

Insert queries must always use a query builder object(layer of abstraction), allowing individual database drivers special handling for column values (if applicable), example case for LOB and BLOB fields.
#DatabaseQueryTips

Drupal uses the .inc extension to prevent files from being executed directly.
#DevelopmentTips

Popular Posts