Select Page

Category: Web Development

Set Up Caching in PHP With the Symfony Cache Component

Today, I’ll show you the Symfony Cache component, an easy way to add caching to your PHP applications. This helps improve the overall performance of your application by reducing the page load time. The Symfony Cache Component The Symfony Cache component allows you to set up caching in your PHP applications. The component itself is very easy to install and configure and allows you to get started quickly. Also, it provides a variety of adapters to choose from, as shown in the following list: database adapter filesystem adapter memcached adapter Redis adapter APCu adapter and more When it comes...

Read More

How to Upload a File in PHP (With Example)

In this article, I’ll explain the basics of file upload in PHP. Firstly, we’ll go through the PHP configuration options that need to be in place for successful file uploads. Following that, we’ll develop a real-world example of how to upload a file.  Configure PHP Settings There are a couple of PHP configuration settings that you’ll want to check beforehand for successful file uploads. In this section, we’ll go through each and every option which is important in regards to PHP file upload. These options can be configured in the php.ini file. If you’re not sure where to find your php.ini file, you can use the php_ini_loaded_file() to locate it. Just create a PHP file on your server with the following line, and open it from the browser.   Here is an excerpt from a setup file with some useful defaults. ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files. ; Will use system default if not set. ;upload_tmp_dir = ; Maximum allowed size for uploaded files. upload_max_filesize = 16M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 ; Maximum size of POST data that PHP will accept. post_max_size = 20M max_input_time = 60 memory_limit = 128M max_execution_time = 30 The Key Settings file_uploads The value of the file_uploads directive should be set to On to...

Read More

New Course: Create Your Own Alexa Skill

Creating your own Amazon Alexa skill from scratch is easier than you thought. In our new course, Create Your Own Alexa Skill, you’ll learn how to build a new Alexa skill using Amazon Web Services and Node.js. What You’ll Learn With devices like Amazon Alexa, software is moving into users’ homes and lives in a whole new way. By creating a new Alexa skill, you can allow users to interact with your app using their voice. In this course, Derek Jensen will show you how to build an Alexa skill from start to finish. You’ll get an overview of how skills work in Alexa, and then you’ll go through every step involved in building a real-world skill. By the end, you’ll be confident in creating your own Alexa skills. Here are some free lessons from this course, as a preview of what you can expect: Alexa Skill Kit Walkthrough Before you can really start writing code to interact with Amazon Alexa, you need to understand where and how to create your actual Amazon Alexa skill. This video will provide a basic walkthrough of Amazon Developer Services and show you how to start to create your custom skill.   AWS Lambda Walkthrough Now you have a decent understanding of where and how to create a simple Amazon Alexa skill. But that’s only half of the puzzle: your skill also needs...

Read More

8 New Ways to Refactor Your Code With Swift 4

Swift is one of the fastest-growing languages in history, due to its elegance, simplicity, and “safety by design”. In fact, Swift’s official mantra is “to make programming simple things easy, and difficult things possible”. In this post, you’ll learn how to use Swift to its fullest by refactoring your code. While a lot of the code optimization is implicit and obviously inherent in the language’s design, there are certain refactoring strategies that can make your code more readable, more reliable, and better performing. In this article, you will learn eight ways to refactor your code with Swift 4.  Objectives of This Article  In this article, you will learn some ways to better optimize and refactor your code with Swift 4. We’ll cover the following: handling duplicate keys in dictionaries elegantly with zip setting default values for dictionaries merging dictionaries into one filtering data dictionary values directly into another dictionary object using Codable to save custom objects into JSON swapping values in mutable arrays handling multi-line literals finding random elements in a collection 1. Duplicate Keys in Dictionaries First up, Swift 4 further enhances dictionaries with an elegant way to handle duplicate keys using the generic function zip.  zip works on more than just dictionaries, and in fact it will let you build own sequence type from two underlying collections that conform to Sequence.  For example, say you have an array with the following...

Read More

Site Accessibility: Getting Started With ARIA

What You’ll Be Creating Using standard HTML alone, modern web apps can lock out users with accessibility needs.  HTML is the predominant markup language online, being used by nearly 83% of existing websites. While there have been some changes in the 25 years since its creation, even newer iterations, such as HTML5 and AMP, leave a lot to be desired—especially when it comes to accessibility. That’s where ARIA comes in. In this tutorial, I’m going to talk about what ARIA is, why it’s useful for your site, and a couple of ways it can be added to your site. What Is ARIA? ARIA, also known as WAI-ARIA, stands for The Web Accessibility Initiative’s Accessible Rich Internet Applications. The full specifications document can be found here. Note that the full spec document is fairly dense, so it might be a good idea to start by reading this post and checking out some of the other resources I link below.  The main purpose of ARIA is to allow for advanced semantic structure within HTML as a counterpart to HTML’s syntax-heavy nature. In other words, HTML tells the browser where things go, and ARIA tells it how they interact. Who Is Responsible for ARIA? ARIA is a project hosted by the W3C (World Wide Web Consortium). The project adheres to the same standards for updating and editing as their other initiatives. They...

Read More
000webhost logo