Giter Club home page Giter Club logo

php-materials's Introduction

My php materials

Snippets

Template rendering

How you could render templates with prepared variables is shown within a request util class.

Simple uouting system

But for the routes there is the handler in the same util class that matches specified routes in an associated array.

Autoload

Example of how to setup autoload setup file.

External materials

File handling

File system functions

Php offers many file system functions option which are close to GNU utils by their names.

Form file handling

Examples with explanation in regards to file uploading and handling.

Serving files

The file access options are modified with content-disposition header. That is file can be viewed, downloaded etc.

An example shows how to set this header.

Database

Prepared statements

Mysqli offers parameter binding which is a must for avoiding SQL injections.

Transactions

To make a dry run you can either:

With this sequence, made changes would not be made in database, even though rows would be shown as affected:

$mysqli->rollback();
$mysqli->commit();
$stmt->close();

MariaDB cheatcheet

Cheatsheet from the official mariadb website.

Also, SQL cheatsheet from SQL turorial could come in handy.

Session

Session usage is neatly explained in this stackoverflow question.

Time

One good approach of time handling is to use UTC initially and then adjust it to a relevant timezone if needed.

This example shows how this can be accomplished.

Popular php functions

The 100 top-most used functions in php by exakat.

Algorithms

Most useful algorithms that could be useful.

Setup

Making VSCode into vim (:

  • Istall & enable vim mode extension, e.g., VSCode neovim.
  • Set relative line numbers:
    • Settings (CTRL+comma) > Line Numbers > Change from "On" to "relative".

php-materials's People

Contributors

jorenchik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.