Ticker

6/recent/ticker-posts

How To Build Your First PHP Project

How To Build Your First PHP Project

In the last part of this series we looked at using Code Igniter to build PHP applications and how to use Code Igniter to set up a Vagrant virtual environment that runs your PHP applications. We looked at creating a new project to get started and found out a couple of things that we will need to take care of.

How To Build Your First PHP Project


PHP Plugin

PHP Custom Plugins To begin with, you will need to create a directory for your plugins, copy them into that directory, and register your plugins in PhpStorm. You can choose the quick path or develop option when using the development option. You can then enable your plugins for PhpStorm.

How To Build Your First PHP Project


A Note on Core Extensions: 

There are many applications out there that have the same extension as yours. Unfortunately, by the time you notice it, you may already be using the same version as someone else. That means when you try to update, it could break your application and therefore you will not be able to update it at all.

PHP COMMANDS

PHP Commands When you first download the PHP core and the bundled extensions you will have to use your commands from the command line. If you are running PhpStorm you should be able to open up the project menu and go to commands and add /plugin load php: which will then load your plugin.

PHP COMMANDS


  • Type php in PhpStorm and you will see a list of available commands. 
  • These are commands that you will need to type into the PhpStorm command palette. 
  • If you are using the default theme, they are All, AllPHP, AllVagrant, AllVagrantAll, and Basic.


Initializing a New Project First we will look at what a typical command line to do is. In the command palette go to the tab and add "php", then in the resulting box, type "php -v" and then click "OK". You will then be asked to choose a php interpreter, choose the one you are using.

USES OF PHP EXTENSION

Next, run phpmyadmin from the command palette and browse to the php interpreter you chose. You should now be able to edit the files with your editor. Now that you have successfully added your PHP extensions, you will want to configure your project in order to use them.

extensions.php

Create a new folder for your plugins, cd into that folder, and copy all of your plugins files into that folder. Make sure to create a file called extensions.php with the extension extensions. Then copy and paste the extensions files into your project.


You will now need to initialize a new project to make your new plugins work. Select the new project menu, select "New Project", choose a name, choose the "PHP" template, click "Next" and then give the project a description, choose a theme, and finally specify where you would like to install your extensions.

mydomain.php

Remember to set the "Enable Unknown Extensions" option. Finally, check the "Scripts" and click "Finish". Now you can run your project and in the "Console" section of the Preferences window click "Run" and go to the 'View' tab and then click "Next". For a sample PHP web server command you will be needed to create a file called mydomain.php and insert the following code, but remember to change the extension to .php.


Now run your new PHP script in the console and after the user has logged in, click "View" to show the "Basic Auth User" table. You will find a couple of useful commands here, and some of them will be obvious, for example "mydomain.php" is the name of your domain, and "Basic Auth User" is the user that you created previously.


In conclusion, you can always continue to install your extensions after you know how to use them, but you should also know how to deal with any security issue that may come up. Hopefully this has helped you understand the basics of how to set up PHP.

Post a Comment

0 Comments