Download the PHP package tyty16/sqldeadcolumnfinder without Composer

On this page you can find all versions of the php package tyty16/sqldeadcolumnfinder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sqldeadcolumnfinder

SQLDeadColumnFinder

A php class designed to find "dead" columns in a SQL database (Null or only 1 unique value).

Installation

This library requires PHP 5.1 or later, but it is recommended to use the latest version of PHP. It does not have any other dependencies.

It can either be autoloaded and installed via Composer tyty16/sqldeadcolumnfinder, or can be downloaded on its own.

Getting Started

Instantiation

Instantiate the SQLDeadColumnFinder class with the pdo connection along with the name of the database you would like to check. Optional parameters include:

-$all (boolean value indicating whether to check all tables, or just tables with a created_at column) default:false -$months (integer value for how many months prior to the created_at date to check. Used when all is set to false) default:6 -$file (string value for the desired output file name) default:'dead-columns'

Example

Finding Dead Columns

Call the find() method, which will call the individual methods to gather the columns to check, check them, and then export the data to a csv file with either the default file name, or the given file path during instantiation.

Example

Methods

Methods can be called individually, but must follow the expected array format for the input parameters.

getTablesToCheck()

Gathers table names from INFORMATION_SCHEMA to be checked. This will only include tables with a "created_at" column if $all is set to true.

Example

Returned Array Format

getColumnsToCheck($tables)

Gathers column names from INFORMATION_SCHEMA to be checked using the $tables array parameter. $tables must be formatted in the same way as the returned array from getTablesToCheck(). This method also increments the $numColumns field.

Example

Returned Array Format

formatTablesWithColumns($columnsByTable)

Formats columns and table names in a way where nested for loops can be used in findDeadColumns(). The format for $columnsByTable should be the returned array format from getColumnsToCheck().

Example

Returned Array Format

findDeadColumns($dbWithTablesWithColumns)

Searches the given list of columns parameter and finds columns with either one unique value, or is completely null. If the $all is set to false, then only rows that are recent within the number of $months will be included in the search. $dbWithTablesWithColumns must be formatted in the same way as the return array from formatTablesWithColumns(). An array will be returned with the following values for each column:

-distinct (The number of unique values for that column) -value (The distinct value itself) -is_null (Whether the column is completely null)

Example

Returned Array Format

outputToFile($deadColumns)

Takes a list of dead columns, formats them, and outputs them to a .csv file. The format of $deadColumns must be in the same format as the return array from findDeadColumns(). File will be saved either to the default file path as "dead-columns.csv" or what was specified for $file Columns in the .csv are as follows:

-Database: The name of the database contanining the dead column -Table: The name of the table containing the dead column -Column: The name of the dead column -Distinct Values: The number of unique values for the dead column -Value: The distinct value itself -In the past x months: Records the $months value in the file

Example


All versions of sqldeadcolumnfinder with dependencies

PHP Build Version
Package Version
Requires php Version >=5.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tyty16/sqldeadcolumnfinder contains the following files

Loading the files please wait ....