Subscribe to PHP Freaks RSS

TutsPlus.com: How to Use the Symfony Filesystem Component

syndicated from www.phpdeveloper.org on August 29, 2018

The TutsPlus.com site has posted another tutorial spotlighting a component of the Symfony framework. In this latest tutorial they cover the Symfony Filesystem component, a module that provides useful wrapper functionality for common file system-related needs.

In this article, we're going to explore the Symfony Filesystem component, which provides useful methods to interact with a file system. After installation and configuration, we'll create a few real-world examples of how to use it.

The tutorial starts with a brief introduction of the component including a listing of functionality it provides. It then moves on to the installation (via Composer) and use in some sample code. From there they show how to use it to:

  • create a new directory
  • create a new file and add contents
  • copy a directory
  • remove a directory

Each of these includes both a code example and a brief summary of what's happening.