Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Understand Arrays in PHP
Sep 05, 2018 @ 15:48:04

In a recently posted tutorial on the TutsPlus.com site, author Sajal Soni gets back to the basics and covers the use of arrays in PHP.

In this post, you'll learn the basics of arrays in PHP. You'll learn how to create an array and how to use associative and multidimensional arrays, and you'll see lots of examples of arrays in action.

The tutorial then starts with a brief introduction to what arrays are and how they're defined. From there it shows:

  • how to access array elements
  • types of arrays
  • some useful array-related functions

Each item (and function example) comes with a code snippet to show it in use as well as a brief summary of what's happening.

tagged: array introduction basics tutorial function types

Link: https://code.tutsplus.com/tutorials/understand-arrays-in-php--cms-31738

SitePoint PHP Blog:
Re-Introducing Composer – the Cornerstone of Modern PHP Apps
May 22, 2017 @ 16:54:48

If you've been developing any kind of PHP applications lately, chances are you've at least heard of Composer. This package manager has dramatically changed the way we develop in PHP but there are still some out there wondering what all the fuss is about. In this tutorial from SitePoint author Claudio Ribeiro (re-)introduces this powerful tool and provides some basics of its use.

In this article, we will tackle the basics of Composer, and what makes it such a powerful and useful tool.

Before we go into detail, there are two things that we need to have in mind: what Composer is [and] what Composer is not. [...] Essentially, Composer allows you to declare and manage every dependency of your PHP projects.

He then walks you through the installation of the tool, running it either globally or locally (per-project). He lists out some of the basic commands, what they're for and helps you on your way to installing your first package: PHPUnit. He also covers the special "vendor" folder Composer creates, how autoloading works, various configuration values and installing packages globally rather than just locally. He then talks about the other side of the PHP package ecosystem: Packagist including how to submit packages and set up your own package's composer.json so it can be pulled in correctly.

tagged: composer introduction basics tutorial package packagist

Link: https://www.sitepoint.com/re-introducing-composer/

Laravel News:
Seven Tips to Learn Laravel More Effectively
Jan 09, 2017 @ 16:25:17

For those out there wanting to learn more about the Laravel framework but weren't sure where to start, the Laravel News site has just the post for you. In this new guide they provide seven steps to help you learn about Laravel and its use more effectively.

As the community grows, there are many resources available to help you learn Laravel. That’s great! But, how do you choose the best one? Which will be the best use of your time to read or watch? For those new to the framework, I’m sure these questions are on your mind, here are seven tips to help you learn Laravel more effectively.

Some of these tips will be specific to Laravel, while others are more general for learning any programming language or framework.

Their steps start with some of the more foundational stuff like learning about Composer/OOP/PHP first before venturing into the framework at all. Then, with that knowledge under your belt, you can move on to the other steps: where to learn the most effectively (books, courses, videos, etc) and actually putting fingers to keys and start writing code. He makes recommendations about how to use Google and Stack Overflow to help you find what you need an, finally, the advice to find a mentor to learn from and to not give up even if you hit something difficult.

tagged: laravel effective top7 tips framework basics learning

Link: https://laravel-news.com/seven-tips-to-learn-laravel-more-effectively

TutsPlus.com:
Building Your Startup: Security Basics
Dec 20, 2016 @ 17:55:58

The TutsPlus.com site has continued their "Building Your Startup" tutorial series with this latest article covering the "security basics" you'll need to adequately protect your application. This tutorial touches on both the server-level and code-level security aspects.

In today's episode, we'll dive into the basics of web server security. I'll cover securing the Linux VPS running Meeting Planner and some basic Yii security. In the next episode, I'll dive more into programmatic Yii application security.

The article starts off with the server side of things, introducing hosting options, keeping the server updated, configuring SSH for logins, setting up a firewall and SSL. With that solid base in place, it then starts on the code side covering the built-in functionality used to secure the backend and frontend functionality.

tagged: tutorial series yii2 startup security basics server code

Link: https://code.tutsplus.com/tutorials/building-your-startup-security-basics--cms-26702

Auth0 Blog:
Creating your first Symfony app and adding authentication
Aug 03, 2016 @ 17:36:21

In this new post to the Auth0 blog Prosper Otemuyiwa shows you how to create a first Symfony framework based application and add in authentication with the included Guard functionality.

Symfony is a PHP framework, made up of a lot of decoupled and reusable components. It's a framework that promotes standardization and professionalism, supports best practices and interoperability of applications. In this tutorial, I'll show you how easy it is to build a web application with Symfony and add authentication to it without banging your head on a wall! Check out the repo to get the code.

They start with a brief overview of some of the components the framework is made up of (the most commonly used ones) and its concept of "bundles". He then helps you create your first Symfony application, explains its basic structure and starts in setting up controllers. Then comes the authentication and user validation pieces: registration handling, user functionality and creating its related database storage. Next up is setting up the routes for the application applying the authentication handling and finishing out the views for output. They end the post with a look at the profile debug bar, how Symfony compares to other frameworks and how to optionally integrate the Auth0 functionality in if you choose.

tagged: auth0 symfony introduction basics tutorial authentication integration

Link: https://auth0.com/blog/creating-your-first-symfony-app-and-adding-authentication/

Loggly.com:
The Ultimate Guide - PHP Logging Basics
Dec 08, 2015 @ 17:34:32

Loggly, the online logging management service, has posted a guide that aims to help you get up to speed with logging in PHP starting from the basics out to more recent changes in PHP 7.

This guide explores the basics of logging in PHP, where to find PHP logs, and how these logs help you more effectively troubleshoot problems and monitor your PHP application. There are a couple of different elements you’ll want to consider logging: errors emitted by the PHP engine itself when a core function fails or if code can’t be parsed, custom errors that your application triggers, usually caused by missing or incorrect user input and activities in your application that you may want to analyze at a later time, such as recording when a user account is updated or content in a CMS is updated

They start with a look at the configuration settings you can change to modify how and what your application logs. They also mention run-time configuration changes and the default error log locations (file-based). From there they get into some of the basic, built-in logging functions and the format of the logs they write. The next section talks about application error logs (logs based on failures in PHP itself) and an example of writing logs with JSON instead of plain text. The post ends with a look at exception handling and logging for base, custom and SPL exception types, pointing out the change in PHP 7 around the Throwable interface.

tagged: logging basics application custom tutorial function introduction configuration

Link: https://www.loggly.com/ultimate-guide/php-logging-basics/

Brandon Savage:
The framework you learn doesn’t really matter
May 20, 2014 @ 14:21:50

In this new post to his site Brandon Savage suggests that you don't learn any particular framework - learn PHP first, then move up from there.

Towards the end of my talk at phpDay in Verona, I was asked by two developers which framework I thought they should learn: Symfony or Laravel. I understand the pressure that developers feel like they’re under to learn a framework, and to somewhat “predict the future” by figuring out what is likely to be popular in PHP for the next few years. But my answer to them wasn’t what they expected. I told them that if they were new to PHP, that they should focus on learning PHP.

He notes that while frameworks can make it easier to get up and running more quickly, they can also make "tribes" if there's not a solid foundation in the language first. If the developer knows the language first, they can move into any framework and with limited effort pick it up and run with it. PHP frameworks come and go, and learning just one can limit you future when its popularity fades.

tagged: framework learn language opinion basics

Link: http://www.brandonsavage.net/the-framework-you-learn-doesnt-really-matter

SitePoint PHP Blog:
Using Solarium with SOLR for Search – Implementation
May 07, 2014 @ 15:54:10

The SitePoint PHP blog has posted the third part of their series looking at using the Solarium tool to hook your PHP application into a SOLR search instance. In this latest part of the series they get down to the actual search implementation.

In the first part I introduced the key concepts and we installed and set up SOLR. In part two we installed and configured Solarium, a library which enables us to use PHP to “talk” to SOLR as if it were a native component. Now we’re finally ready to start building the search mechanism, which is the subject of this installment.

He starts with a simple search example, making a request to select the matches for a given query (given on the URL as a variable "q"). He shows how to run the select and fetch the results as a result set. He enhances this, containing the search logic inside a class and making a template to show the results. He also includes examples of how to use the "Disjunction Max", sorting and pagination functionality. Finally, he looks at a more complex type of search, a faceted search, and includes code examples of making the request and displaying the results.

tagged: solr solarium search engine tutorial implement basics faceted

Link: http://www.sitepoint.com/using-solarium-solr-search-implementation/

NetTuts.com:
Routing Overview & Basics in Symfony 2
Apr 17, 2014 @ 17:10:12

If you're relatively new to using the Symfony2 framework, you might be wondering about some of the things happening during requests to your application. One of these things is the routing and handling of each request. In this new post from NetTuts.com they introduce you to the foundations of Symfony2 routing in a screencast.

In the last video, I said we'd take a look at controllers next, but I actually feel it may be easier to learn the framework in a slightly different order. Instead, we're going to learn about the basics of Symfony 2 routing, to give our applications clean and pretty URLs and make it easy to manage our applications URLs and links. We're not going to get too detailed, as Symfony's routing can do quite a bit, but we'll at least cover what we need to know by keeping it straight and to the point.

The screencast is a bit less than 10 minutes long and provides an overview of the routing, how it interacts with bundles and controllers. There's also a bit about using annotations to help define routing information directly in the controller.

tagged: routing basics symfony2 introduction screencast demo

Link: http://code.tutsplus.com/tutorials/routing-overview-basics-in-symfony-2--cms-20754

DZone.com:
PHP Performance Crash Course, Part 1: The Basics
Jun 12, 2013 @ 19:56:13

In a recent post to DZone.com Dustin Whittle talks about performance in PHP applications and gives you a crash course on some of the basics around it (this is part one of a series).

We all know performance is important, but performance tuning is too often an afterthought. As a result, taking on a performance tuning project for a slow application can be pretty intimidating – where do you even begin? In this series I’ll tell you about the strategies and technologies that (in my experience) have been the most successful in improving PHP performance. To start off, however, we’ll talk about some of the easy wins in PHP performance tuning. These are the things you can do that’ll get you the most performance bang for your buck, and you should be sure you’ve checked off all of them before you take on any of the more complex stuff.

He talks some about why performance matters and some of the more common practices to introduce immediate performance improvements into your application. His list includes things like: update PHP, use an opcode cache, use autoloading and session optimization. He also talks about using processing queues for blocking work and learning how to use code profiling tools to find the pain points.

tagged: performance crash cource series part1 basics

Link: http://java.dzone.com/articles/php-performance-crash-course


Trending Topics: