PHPinsights: Instant PHP Quality Checks From Your Console

PHPinsights

PHP Insights was carefully crafted to simplify the analysis of your code directly from your terminal, and is the perfect starting point to analyze the code quality of your PHP projects. It was created by Nuno Maduro, logo design Caneco, and currently is maintained by Chris Gmyr, Jibé Barth, and Steve McDougall.

🚀 Quick start

# First, install:
composer require nunomaduro/phpinsights --dev

# Then, use it:
./vendor/bin/phpinsights

# For Laravel:
First, publish the configuration file:
php artisan vendor:publish --provider="NunoMaduro\PhpInsights\Application\Adapters\Laravel\InsightsServiceProvider"

Then, use it:
php artisan insights

✨ Features

  • Analysis of code quality and coding style
  • Beautiful overview of code architecture and its complexity
  • Designed to work out-of-the-box with Laravel, Symfony, Yii, Magento, and more
  • Contains built-in checks for making code reliable, loosely coupled, simple, and clean

For full documentation, visit phpinsights.com.

Download Details:

Author: Nunomaduro
Source Code: https://github.com/nunomaduro/phpinsights 
License: MIT license

#php #cli #console #analytics 

What is GEEK

Buddha Community

PHPinsights: Instant PHP Quality Checks From Your Console

PHPinsights: Instant PHP Quality Checks From Your Console

PHPinsights

PHP Insights was carefully crafted to simplify the analysis of your code directly from your terminal, and is the perfect starting point to analyze the code quality of your PHP projects. It was created by Nuno Maduro, logo design Caneco, and currently is maintained by Chris Gmyr, Jibé Barth, and Steve McDougall.

🚀 Quick start

# First, install:
composer require nunomaduro/phpinsights --dev

# Then, use it:
./vendor/bin/phpinsights

# For Laravel:
First, publish the configuration file:
php artisan vendor:publish --provider="NunoMaduro\PhpInsights\Application\Adapters\Laravel\InsightsServiceProvider"

Then, use it:
php artisan insights

✨ Features

  • Analysis of code quality and coding style
  • Beautiful overview of code architecture and its complexity
  • Designed to work out-of-the-box with Laravel, Symfony, Yii, Magento, and more
  • Contains built-in checks for making code reliable, loosely coupled, simple, and clean

For full documentation, visit phpinsights.com.

Download Details:

Author: Nunomaduro
Source Code: https://github.com/nunomaduro/phpinsights 
License: MIT license

#php #cli #console #analytics 

Hire PHP Developer

Looking to develop a PHP based website from scratch or revamp your existing website?

HourlyDeveloper.io has always been an industry leader for companies and business owners looking to hire PHP web developer. By choosing to Hire PHP Developer from our company, you can always expect the best results. Our PHP services and solutions are always flexible which means that no matter the nature of your project, you can always count on us for getting the best PHP expertise.

Consult with our experts: https://bit.ly/3aEGxPy

#hire php developer #php developer #php development company #php development services #php development #php

Hire PHP Developer - Best PHP Web Frameworks for Web Development

A framework that can drastically cut down the requirement to write original code to develop the web apps as per your requirement is PHP Framework. PHP frameworks offer code libraries for commonly used functions to reduce the development time.

Want to use PHP Web Frameworks for your web applications?

WebClues Infotech offers a service to hire dedicated PHP developers for all of the below-mentioned frameworks

  • Laravel Developer
  • Codeigniter Developer
  • Yii Developer
  • Zend Developer
  • Cake PHP Developer
  • Core PHP Developer

Not sure which framework to use for your PHP web application?

Contact us

Schedule Interview with PHP Developer https://bit.ly/3dsTWf0

Email: sales@webcluesinfotech.com

#hire php developer #hire php web developers #hire php developer in 2021 #hire php developers & dedicated php programmers #hire php developers india #hire and outsource freelance php developers

5 Favorite PHP Libraries for File Manipulation and MIME Type Detection

In today's post we will learn about 5 Favorite PHP Libraries for File Manipulation and MIME Type Detection.

What is MIME type detection?

The most simple way to detect the MIME type of any file is to use MIME_Type's static autoDetect() method. It will try to determine the file's type and return it as a string. If an error occurs, a PEAR_Error object is returned. By default, only the plain MIME type will be returned, without any comments or parameters.

Table of contents:

  • CSV - A CSV data manipulation library.
  • Flysystem - Abstraction for local and remote filesystems.
  • Gaufrette - A filesystem abstraction layer.
  • PHP FFmpeg - A wrapper for the FFmpeg video library.
  • UnifiedArchive - A unified reader and writer of compressed archives.

1 - CSV:

A CSV data manipulation library.

Csv is a library to ease parsing, writing and filtering CSV in PHP. The library goal is to be powerful while remaining lightweight, by utilizing PHP native classes whenever possible.

Highlights

  • Easy to use API
  • Read and Write to CSV documents in a memory efficient and scalable way
  • Support PHP stream filtering capabilities
  • Transform CSV documents into popular format (JSON, XML or HTML)
  • Fully documented
  • Fully unit tested
  • Framework-agnostic

System Requirements

You need the mbstring extension to use Csv and the latest stable version of PHP is recommended.

Please find below the PHP support for Csv version 9.

Min. Library VersionMin. PHP VersionMax. Supported PHP Version
9.0.0PHP 7.0.10PHP 7.1.x
9.1.2PHP 7.0.10PHP 7.2.x
9.2.0PHP 7.0.10PHP 7.4.x
9.6.0PHP 7.2.5PHP 7.4.x
9.6.2PHP 7.2.5PHP 8.0.x
9.7.0PHP 7.3.0PHP 8.0.x
9.7.3PHP 7.3.0PHP 8.1.x
9.8.0PHP 7.4.0PHP 8.1.x

Install

Install Csv using Composer.

composer require league/csv

Configuration

Warning: If your CSV document was created or is read on a Macintosh computer, add the following lines before using the library to help PHP detect line ending.

if (!ini_get("auto_detect_line_endings")) {
    ini_set("auto_detect_line_endings", '1');
}

Testing

The library has a :

To run the tests, run the following command from the project folder.

composer test

View on Github

2 - Flysystem:

Abstraction for local and remote filesystems.

Flysystem is a file storage library for PHP. It provides one interface to interact with many types of filesystems. When you use Flysystem, you're not only protected from vendor lock-in, you'll also have a consistent experience for which ever storage is right for you.

Getting Started

Officially supported adapters

Third party Adapters

You can always create an adapter yourself.

Security

If you discover any security related issues, please email info@frankdejonge.nl instead of using the issue tracker.

View on Github

3 - Gaufrette:

A filesystem abstraction layer.

Gaufrette provides a filesystem abstraction layer.

Why use Gaufrette?

Imagine you have to manage a lot of medias in a PHP project. Lets see how to take this situation in your advantage using Gaufrette.

The filesystem abstraction layer permits you to develop your application without the need to know where all those medias will be stored and how.

Another advantage of this is the possibility to update the files location without any impact on the code apart from the definition of your filesystem. In example, if your project grows up very fast and if your server reaches its limits, you can easily move your medias in an Amazon S3 server or any other solution.

Development

Requires :

  • docker-ce
  • docker-compose

Create .env file :

$ make docker.dev

and configure it as you want.

Build the php docker image :

$ make docker.build

Install dependencies :

$ make docker.all-deps

Run tests :

$ make docker.tests

You can also use a different php version, simply set the PHP_VERSION env var to any of these values when calling a make target :

See the docker-compose.yml file for more details.

You'll need to clear the previously installed dependencies when switching from a version to an other, to do so, run :

$ make clear-deps
$ PHP_VERSION=<the_version_you_want_to_use> make build install-deps

Apply Coding Standards

You should check for CS violations by using

$ make php-cs-compare

and fix them with

$ make php-cs-fix

Note

This project does not have any stable release yet but we do not want to break BC now.

View on Github

4 - PHP FFmpeg:

A wrapper for the FFmpeg video library.

An Object-Oriented library to convert video/audio files with FFmpeg / AVConv.

Installation

This library requires PHP 8.0 or higher. For older versions of PHP, check out the 0.x-branch.

The recommended way to install PHP-FFMpeg is through Composer.

$ composer require php-ffmpeg/php-ffmpeg

Basic Usage

require 'vendor/autoload.php';

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('video.mpg');
$video
    ->filters()
    ->resize(new FFMpeg\Coordinate\Dimension(320, 240))
    ->synchronize();
$video
    ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
    ->save('frame.jpg');
$video
    ->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4')
    ->save(new FFMpeg\Format\Video\WMV(), 'export-wmv.wmv')
    ->save(new FFMpeg\Format\Video\WebM(), 'export-webm.webm');

Documentation

This documentation is an introduction to discover the API. It's recommended to browse the source code as it is self-documented.

FFMpeg

FFMpeg\FFMpeg is the main object to use to manipulate medias. To build it, use the static FFMpeg\FFMpeg::create:

$ffmpeg = FFMpeg\FFMpeg::create();

FFMpeg will autodetect ffmpeg and ffprobe binaries. If you want to give binary paths explicitly, you can pass an array as configuration. A Psr\Logger\LoggerInterface can also be passed to log binary executions.

$ffmpeg = FFMpeg\FFMpeg::create(array(
    'ffmpeg.binaries'  => '/opt/local/ffmpeg/bin/ffmpeg',
    'ffprobe.binaries' => '/opt/local/ffmpeg/bin/ffprobe',
    'timeout'          => 3600, // The timeout for the underlying process
    'ffmpeg.threads'   => 12,   // The number of threads that FFMpeg should use
), $logger);

You may pass a temporary_directory key to specify a path for temporary files.

$ffmpeg = FFMpeg\FFMpeg::create(array(
    'temporary_directory' => '/var/ffmpeg-tmp'
), $logger);

Manipulate media

FFMpeg\FFMpeg creates media based on URIs. URIs could be either a pointer to a local filesystem resource, an HTTP resource or any resource supported by FFmpeg.

Note: To list all supported resource type of your FFmpeg build, use the -protocols command:

ffmpeg -protocols

To open a resource, use the FFMpeg\FFMpeg::open method.

$ffmpeg->open('video.mpeg');

Two types of media can be resolved: FFMpeg\Media\Audio and FFMpeg\Media\Video. A third type, FFMpeg\Media\Frame, is available through videos.

View on Github

5 - UnifiedArchive:

A unified reader and writer of compressed archives.

How it works

UnifiedArchive uses "drivers", which can be one of types:

  1. PHP Extensions
  2. Utilities + bridge
  3. Pure PHP

By default, UA goes top-down to select first available driver for passed archive. So, PHP Extension driver will be used (if available), then Utilities + bridge driver (if available), and then Pure PHP driver.

There is at least one driver in all three types, which handles zip format, so this format can be fully supported in any OS/PHP configuration:

  1. zip / phar PHP extensions
  2. Utility + bridge SevenZip / AlchemyZippy
  3. Pure NelexaZip

tar format (with compressed variants) supported by:

  1. phar PHP extension
  2. Utility + bridge SevenZip / AlchemyZippy
  3. Pure TarByPear

So, there is always one driver that supports popular formats, and you should not remember how to work with this concrete driver (zip/phar/SevenZip/AlchemyZippy/NelexaZip), interface for them is uniform.

Quick start

Installation and configuration

Install library

composer require wapmorgan/unified-archive
#Check supported formats with installed drivers
./vendor/bin/cam system:formats
#Check supported functions for zip format
./vendor/bin/cam system:format zip

Install new driver

#Read installation instructions from
./vendor/bin/cam system:drivers
#install missing drivers, for example pear/archive_tar
composer require pear/archive_tar
#check out driver functions
./vendor/bin/cam system:formats TarByPear

#if needed, install extensions, cli tools and php libraries
#to enable support of other formats

Usage

use \wapmorgan\UnifiedArchive\UnifiedArchive;

$output_dir = '/var/www/extracted';

# Extraction
$archive = UnifiedArchive::open('archive.zip'); // archive.rar, archive.tar.bz2

if (disk_free_space($output_dir) < $archive->getOriginalSize()) {
    throw new \RuntimeException('No needed space available. Need ' . ($archive->getOriginalSize() - disk_free_space($output_dir)) . ' byte(s) more');
}

$extracted = $archive->extract($output_dir);
echo 'Number of extracted files' . $extracted.PHP_EOL;

# Archiving
UnifiedArchive::archive([
    'README.md' => '/default/path/to/README.md',
    '' => '/folder/with/content/',
], 'archive.zip');

View on Github

Thank you for following this article.

Related videos:

How to Open ZIP Files With PHP

#php #file #type #detection 

Mariya James

Mariya James

1613990718

Top PHP web development company| PHP development services India

ValueCoders is a leading PHP app development company that focuses on building robust, secure & scalable web applications for start-ups, enterprises, and entrepreneurs.

We have 16+ years of experience and have delivered custom PHP web development solutions to 2500+ global clients catering industry verticals, including healthcare, adtech, eLearning, data analysis, Fintech, eCommerce, etc

Are you planning to outsource PHP development services? Or want to hire an offshore PHP development team?

#hire php developer #hire a php developer in india #hire dedicated php programmers #hire php coders #php developer in india #php developers for hire