PHP & Web Development Blogs

Showing 41 to 45 of 47 blog articles.
1682 views · 1 years ago

![PHP Basics](

It's 2018, and you're a top-notch modern web developer, with a load of knowledge and tools right there at your disposal: Google and StackOverflow, debugger with a GUI, IDE with autocomplete, you name it. Occasionally, though, you still find yourself in a plain old text console on a remote server, or you have to do something without IDE, or there is no network connection... In such cases it might be helpful to feel comfortable in a simple terminal. In this post I'm going to list some switches for the PHP command that you can use to get information and some utilities.

### Getting basic information about PHP


$ php -i


PHP Version => 7.2.10-0ubuntu1

System => Linux awesome 4.18.0-10-generic #11-Ubuntu SMP Thu Oct 11 15:13:55 UTC 2018 x86_64

Build Date => Sep 13 2018 13:38:55

Server API => Command Line Interface

Virtual Directory Support => disabled



Full information about your PHP interpreter. Pipe the output to the Unix `less` command in order to get pagination and search: `php -i | less`. Type `Q` to exit the `less` shell. Some distros might lack `less`, in that case you may try `php -i | more`, which doesn't give you search but still has pagination.

Want a short summary of which PHP extensions you have? Just ask:


$ php -m

[PHP Modules]










### More specific info about core and extensions' functions and classes

Full information about functions and classes provided by an extension:


$ php --re ds

Extension [ <persistent> extension #46 ds version 1.2.6 ] {

- Dependencies {

Dependency [ json (Required) ]

Dependency [ spl (Required) ]


- Classes [11] {

Interface [ <internal:ds> interface Ds\Hashable ] {

- Constants [0] {


- Static properties [0] {




Information on a specific class:


$ php --rc Ds\\Vector

Class [ <internal:ds> <iterateable> final class Ds\Vector implements Ds\Sequence, Traversable, Countable, JsonSerializable, Ds\Collection ] {

- Constants [1] {

Constant [ public integer MIN_CAPACITY ] { 8 }


- Static properties [0] {




Same for a function:


$ php --rf fopen

Function [ <internal:standard> function fopen ] {

- Parameters [4] {

Parameter #0 [ <required> $filename ]

Parameter #1 [ <required> $mode ]

Parameter #2 [ <optional> $use_include_path ]

Parameter #3 [ <optional> $context ]




### Utilities

Ever found yourself creating a dummy PHP file of just a few lines - only to be run once and then deleted? The `-a` switch might be what you're looking for:


$ php -a

Interactive mode enabled

php > var_dump(join(", ", [1, 2, 3]));

php shell code:1:

string(7) "1, 2, 3"

php >


It starts an interactive shell so you can type any PHP code and execute it straight away. Requires PHP to be compiled with `readline` support (most distros have that anyway).

Want a quick check for any parse/syntax errors in a PHP file? Use linter:


$ php -l test.php

PHP Parse error: syntax error, unexpected 'array_shift' (T_STRING) in test.php on line 4

Errors parsing test.php


### It has a web-server!

Yes! Just in case you missed it, as of PHP 5.4.0, the CLI SAPI provides a built-in web server. Want a quick look at a web page generated by an app? Here you go:


$ cd /my_application/document_root

$ php -S localhost:8000


Then open http://localhost:8000/ in your browser of choice and enjoy!

Hope you also have enjoyed this reading. Your feedback and questions are always appreciated!

2746 views · 1 years ago

Halloween is filled with ghouls, ghosts, zombies and lots of other spookiness, but the scariest thing ever is FOMO. It’s conference season and several have their call for papers out (including us at Nomad PHP :D). This is the perfect time for you to share your knowledge with the community. Whether it’s your first time or 100th time - it can be scary to put yourself out there and do a talk, but worse than that is not taking the chance and submitting your talk and doing the presentation. Plus, many of these events host lightning talks (short 5-15 minute talks) - meaning you can test out your talk risk free ;)


So here is your chance - submit for one or submit for all of them. May the odds be ever in your favor!

## Fosdem 2019

First we have Fosdem 2019 which will take place on February 2 & 3 in Brussels,Belgium. Some facts about this call for papers:

* **Deadline:** November 3, 2018

* Presentations are expected to be 50 minutes long (including audience questions) and should cater to a varied technical audience. For examples check out [youtube](

* **Submit** your proposals via Pentabarf: [](

* The conference covers reasonable travel expenses agreed upon in advance as well as arranges accommodations

## Midwest PHP 2019

Next up we have Midwest PHP which will take place on March 8 & 9 in Bloomington, Minnesota.

* **Deadline:** November 15, 2018

* There is a speaker package included (conference pass, 2 hotel nights, airfare/travel - $500 max, lunch, etc.)

* Make sure the talk title and abstract define the exact topic and what you hope people will learn from it.

* Recommended to submit more than one talk because it can increase your chances of one of them being picked.

* **Submit** your talk here: [] (

## Longhorn PHP

Next we have Longhorn PHP which will take place on May 2 (tutorial day) then MAy 3 &4 (conference) in Austin, Texas.

* **Deadline:** December 15, 2018

* For all speakers, you'll get a full conference pass (tutorial day and main conference days), including access to lunch, after-parties, and any other activities included in the conference.

* For speakers remote to the Austin area, we'll provide 3 nights at the speaker hotel (4 nights if presenting a talk and a tutorial) near the conference venue.

* For speakers outside Texas, we'll book you an Economy or equivalent round-trip airfare on a flight into Austin we'd be comfortable taking ourselves (we're conference speakers too!). Plus, we'll arrange transportation between the Austin airport and the speaker hotel.

* Three different session lengths: 3 hour tutorials, 60 minute talks, and 30 minute talks.

* It doesn't have to just be a PHP related talk. For more information on talks click [here](

* **Submit** your talk here: [](

## Laravel Live India 2019

Then we have LaravelLive India 2019 in Mumbai, India.

* **Deadline:** December 31, 2018

* Talk length is 30 minutes - Q&A up to the presenters discretion but would be included in the 30 minute time limit.

* Talks will be recorded and distributed for free as well as the presentation slides.

* Looking for a range of talks from PHP (security, testing and frameworks), web development, HTML5, JavaScript, mobile development, emerging technologies and non-technical proposals that will appeal to developers.

* **Talk guidelines:** Objective with clear expectation for audience, short and to the point description, mention of employer is only allowed at the beginning of the content and background image/wallpaper shouldn’t include company name/logos.

* **Submit** your talk here: [] (

## Nomad PHP

#### (you know you want to)

Last but not least - this is an ongoing call for papers. This is perfect if you want to present from the comfort of your office, home or really wherever you are. It’s via RingCentral meetings and will be live and recorded. This is for none other than Nomad PHP.

* **Deadline:** Anytime :D

* Talk length: 45 - 60 minutes.

* Talks should be unique to Nomad PHP and not available in video format online.

* Talk should not be recorded or made available elsewhere online for at least 3 months following your talk.

* The talk will be featured on our page and promoted via social media.

* Speakers will receive a financial stipend.

* Upon being selected we will reach out with further details.

* **Submit** here: [] (

Now that you have some information - it’s the perfect time to take it all in and get started on your talk proposals :)! Looking forward to seeing all the amazing talks that will be coming out!!!

2325 views · 1 years ago

![Oprah: You Get Extension! Everyone Get Extension!](

Ever wanted to publish your own extension for PHP but stopped by the lack of C language background? Well, maybe it's time for another take. [Zephir language]( is targeted at people like you.

If you follow this link, you will find these words that say a lot about this project:

> Zephir, an open source, high-level language designed to ease the creation and

maintainability of extensions for PHP with a focus on type and memory safety.

Its syntax highly resembles that of PHP, only there's no dollars scattered around your code. Dollar signs, I mean, the PHP `$variables`. You only can create object oriented extensions, and all the classes written in Zephir must be namespaced. A different and stricter type system exists in Zephir, which allows for transpiling the code you write, into a real C extension.

Why would you need it? This question is largely answered here: [Why Zephir]( I can only add that, from experience, if you expect a crazy performance boost, you probably won't get it. First, most of the time the bottleneck is not PHP but the IO: database interactions, network and filesystem interactions etc. You won't gain anything by switching to different programming language, in that regards. However, some CPU-intensive calculations may run a lot faster, and if you worry about someone stealing you intellectual property - it also might be worth checking out, because then you can ship your software in form of a binary.

Zephir is the language in which the fastest modern PHP framework is written - [Phalcon]( Whether or not to use it - decide for yourself, it obviously has its pros and cons. But it's certainly interesting to know that you have the ability to approach some of your tasks completely differently!

See you around, and feel free to comment!

4106 views · 2 years ago

![Welcome to PHP 7.1](

In case you are living under a rock, the latest version of PHP released last week. PHP developers around the world began rebuilding their development containers with it so they can run their tests. Now it’s your turn. If you haven’t already installed it, you can download it here Grab it, get it running in your development environment, and run those unit tests. If all goes well, you can begin planning your staged deployment to production.

If you need a quick start guide to get you going, our good friend Mr Colin O’Dell has just the thing for you [“Installing PHP 7.1”]( It’ll get you up and going quickly on PHP 7.1.

What’s the big deal about PHP 7.1? I am so glad you asked. Here are the major new features released in PHP 7.1.

* [Nullable types](

* [Void return type](

* [Iterable pseudo-type](

* [Class constant visiblity modifiers](

* [Square bracket syntax for list()]( and [the ability to specify keys in list()](

* [Catching multiple exceptions types](

Now if you want a quick intro to several of these new features, check out our [“RFCs of the Future”]( playlist on YouTube. In it, I talk about 4 of the new features.

Oh and while you are watching things download & compile, why not take the time to give a shoutout to all the core contributors, and a special thank you to [Davey Shafik]( and [Joe Watkins](, the PHP 7.1 release managers.



9541 views · 2 years ago

![Install Composer for PHP](

Composer is a must-have tool for every PHP developer these days. This page is a simple breakdown of quick-install instructions.

## How do I install composer?

1. Use PHP to download the composer installer, place it in the current directory, and name it `composer-setup.php`

2. Use PHP to check the hash of the file you downloaded and compare it to the known value of the hash. You can always find the current value of the hash for the installer on the [Composer Public Keys / Signatures]( page.

3. Run the setup program to install composer. This does more than just download the latest copy of composer, it also sets up your local ~/.composer directory. This will install composer into the current directory. You can add the --install-dir=DIR to specify where you want composer installed. You can also specify --filename=composer to change the installed filename. You can use anything you like that doesn’t already exist in your specified directory, you don’t have to use the name composer. This is a great way to get rid of the .phar at the end of the name if you don’t like it.

4. Use PHP to remove the installer from the current directory.

**To install composer for PHP you use PHP to download the installer, set a few options, and then actually perform the install.**

```php -r "copy('', 'composer-setup.php');"```

```php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"```

```php composer-setup.php```

```php -r "unlink('composer-setup.php');"```

Below is a version you can copy ‘n paste.


## Recommended Setup for Linux and macOS:


php -r "copy('', 'composer-setup.php');"

php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php --install-dir=/usr/local/bin --filename=composer

php -r "unlink('composer-setup.php');"```

**WARNING**: Line two IS WHERE IT compares the hasH of the installer you just downloaded to a hard-coded value. The value specified in the script is the value for the current version of the installer as of this writing. If it fails, check the [Composer Public Keys / Signatures]( page and get the latest version. Plug it into the script below and try again.

Windows user, change the `--installdir=` to a directory in your path.

## Recommended Setup for Windows

If you are running Microsoft Windows, the instructions above will work for you as long as you use the proper install paths. You can however download ComposerSetup.exe from the [Composer Introduction]( page. Execute this and it will install composer and set your path so that you can run composer from anywhere. You will have to close your terminal window and open a new one after the install for the path to be updated.

That’s it, you should now have Composer installed.

## Composer installation Resources

* [Composer Homepage](

* [Composer Introduction](

* [Download Composer](

* [Composer Public Keys / Signatures](


Faster PHP Cloud Hosting