Skip to content

Shaxadhere/phprapid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Shexadd | Twitter

a php functions library that helps you to write code effieciently, it helps you perform database operations, validation, tracking user and some other cool stuff by just calling functions.

How To Install:

  • clone the repository.
  • copy it somewhere inside your application.
  • include rapid.php in your application's root or wherever you want to call methods.

Methods:

Essentials:

  • πŸ†• sendMail(smtpHost, smtpPort, smtpEmail, smtpPassword, smtpProtocol, smtpFrom, recipient,isHTML, subject, message)
  • πŸ†• uploadFile(file, directory, maxSize)

Tracking User

  • trackIP(ip)
  • getOS()
  • getBrowser()

SQL

  • insertData(table, fields, values, conn)
  • fetchData(table, conn)
  • fetchDataById(table, PrimaryKey, id, conn)
  • deleteDataById(table, PrimaryKey, id, conn)
  • editData(table, data, PrimaryKey, id, conn)
  • πŸ†• verifyValues(table, data, conn)
  • checkExistance(table, column_name, value, conn)
  • getLastRow(table, PrimaryKey, conn)
  • verifyValues(table, data, conn)

Validation

  • verify_email(email)
  • verify_phone(phone_number)
  • validateDate(date, seperator)
  • validatePassword(password)
  • validateUsername(username)
  • validatePlainText(plainText)
  • validateAlphanumeric(alphanumeric)
  • validateEmail(email)

Other Functions

  • πŸ†• estimate_gender(name)
  • clean_text(string)
  • random_strings(length_of_string)
  • getNextDays(number_of_days)
  • calcMonths(start_date, end_date)
  • getHeader(pageName, headerPath)
  • getFooter(footerPath)
  • redirectWindow(url)
  • showAlert(msg)
  • generateInsult()
  • generateAdvice()
  • generateQuote()

How To Use:

πŸ†• uploadFile:

uploads file for now it only support .jpg, .png, .jpeg, .gif files

uploadFile(
    $_File['image'],
    '/assets/imges',
    1000
);

πŸ†• sendMail:

sends email using PHPMailer

sendMail(
    'your smtp host',
    'your port',
    'your smtp email',
    'your smtp password', 
    'your smtp protocol',
    'your sender name',
    'your recipent email',
    true,
    'Send Mail',
    'your message'
);

πŸ†• verifyValues:

verifies values from a specific table by writing mysql query

verifyValues(
    "table_name",
    array(
        "field_name",
        "column_name",
        "field_name",
        "column_name"
    )
    $conn
);

πŸ†• trackIP:

tracks user's ip address and retrieves information out of it

trackIP('168.212. 226.204')

πŸ†• getOS:

gets user's operating system

getOS()

πŸ†• getBrowser:

gets user's browser name

getBrowser()

πŸ†• verify_phone:

verifies phone number and retreives some information out of it

verify_email("13654008480")

πŸ†• verify_email:

verifies if email is true and valid without sending a mail

verify_email("[email protected]")

πŸ†• estimate_gender:

estimates a gender from a first name

estimate_gender("Shehzad")

insertData:

this method wont return any value it will just insert the data.

insertData(
    "table_name",
    array(
        "column1_name",
        "column2_name"
        ),
    array(
        "value1",
        "value2"
    ),
    $connection
);

fetchData:

this method will return mysqli_query result, you can handle it that way.

fetchData(
    "table_name",
    $connection
);

fetchDataById:

this method will return mysqli_query result, you can handle it that way.

fetchDataById(
    "table_name",
    "primary_key_column_name",
    $primary_key_value,
    $connection
);

deleteDataById:

this method wont return any value it will just insert the data.

deleteDataById(
    "table_name",
    "primary_key_column_name",
    $primary_key_value,
    $connection
);

editData:

this method wont return any value it will just insert the data.

editData(
    "table_name",
    array(
        "column_name",
        "value",
        "column_name",
        "value"
    ),
    "primary_key_column_name",
    $primary_key_value,
    $connection
);

πŸ†• verifyValues:

this method verifies values from a specific table by writing mysql query

verifyValues(
    "table_name",
    array(
        "column_name",
        "value",
        "column_name",
        "value"
    ),
    $connection
)

checkExistance:

this method will return true if the value exists or else it will return false.

checkExistance(
    "table_name",
    "column_name",
    "value",
    $connection
);

getLastRow:

this method will return mysqli_query result, you can handle it that way.

getLastRow(
    "table_name",
    "primary_key_column_name",
    $connection
);

validateDate:

this method will return true if the provided date is correct or else it wil return false.

validateDate(
    "2020-02-20",
    "-"
);

validatePassword:

this method will check if the password's length is between 8 to 32 and furthur it will check if the password matches at least three of four scenarios which are 1) have at least one symbol 2) have at least one small letter 3) have at least one capital letter 4) have at least one number or else it will return false.

validatePassword(
    "input"
);

validateUsername:

this method will check username according to twitter and instagram standard usernames if the username is correct this will return true or else it will return false.

validateUsername(
    "input"
);

validatePlainText:

this method will return true if the input is plain text or else it will return false.

validatePlainText(
    "input"
);

validateAlphanumeric:

this method will return true if the input is alphanumeric or else it will return false.

validateAlphanumeric(
    "input"
);

validateEmail:

this method will return true if the input is correct email or else it will return false.

validateEmail(
    "input"
);

clean_text:

this method will remove any useless white spaces in text and make the text clean.

clean_text(
    "input"
);

random_strings:

this method will generate random string with combination of caps and small letters and digits of provided length.

random_strings(20);

getNextDays:

this method will return complete dates of number of days provided after todays date in array.

getNextDays(10);

calcMonths:

this method will count months between two days.

calcMonths("date1", "date2");

getHeader:

this method will buffer page name and header everytime the page reloads.

getHeader("any page name", "header file path");

getFooter:

this method will load footer file.

getFooter("footer file path");

redirectWindow:

this method will redirect pages with javascript.

redirectWindow("url");

showAlert:

this method will show alerts with javascript.

showAlert("some text");

generateInsult:

this method generates random evil insult in english

generateInsult();

generateAdvice:

this method generates random advice in english

generateAdvice();

generateQuote:

this method generates random quote in english

generateQuote();

Buy Me a Coffee:

Shexadd | Instagram

About

php library to do things quick

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published