Skip to content

petersistrom/user-upload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

user-upload.php

CLI script that takes a CSV with users (email, name, surname) as an input and parses it into a User class then uploads the users to MySQL user table.

Requirements

user_uplaod.php reqeuires a Linux server, running PHP version: 7.2.x and MySQL database(e.g. MariaDB)

Basic Usage

php user_upload.php --file [users.csv] -u databaseUsername -p databasePassword -h databaseHost  
$dbName in user_upload.php must be reassigned to the name of you database  

Arguments

    --create_table - must be run on initially before other commands. Creates a MySQL table named 'users' containing 'email', 'name', 'surname' cloumns. Drops any previously created 'user' tables and recreates the table on each execution  
    --file [csv file name] - this is the name of the CSV to be parsed  
    --dry_run – this will be used with the --file directive in case we want to run the cript but not insert into the DB. All other functions will be executed, but the database won't be altered  
    -u – MySQL username  
    -p – MySQL password  
    -h – MySQL host  

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages