[note] PHP exec Docker run

For example: use this docker container to convert pdf file to html

  PHP use shell_exec function to exec docker run, there is some notes: Assign a container name with the –name option Automatically clean up the container and remove the file system when the container exits, you can add the –rm flag The input device is not a TTY. …

Continue reading

Hacking with PHP

Don’t think that using references will lower your RAM usage Objects are always copied by reference in PHP 5, which means that copying even the most complex object is instantaneous and essentially free in terms of memory usage. Furthermore, PHP makes extensive use of “copy-on-write”, which means taking ten copies of the same array is …

Continue reading

Secure Your REST API

API Key Mechanism The SERVER and CLIENT share 2 values: a public and private key. The public key can be known by more people, that’s fine. The private key CANNOT. It must only be known by the server and the client. When the client makes a request to the server, it sends along 2 important …

Continue reading

PHP 7 New Features

Deprecated features in PHP 7.0.x PHP 4 style constructors PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated, and will be removed in the future. PHP 7 will emit E_DEPRECATED if a PHP 4 constructor is the only constructor defined within a class. Classes that …

Continue reading

Tour of The Backend Development Skill Set

Mobile Responsive and Mobile Friendly Mobile Responsive When viewed on mobile devices versus desktop clients, responsive email uses “media queries” to adjust the layout of the email message, font sizes, images, and buttons; in some cases, they can even be used hide or swap content. This means, in effect, there are two versions of the …

Continue reading

[Note] Drupal Hook

Hooks From an implementation perspective hooks are specially-named functions called at specific times to alter or add to the base behavior. Each hook has a unique name (example: hook_entity_load()), a defined set of parameters, and a defined return value. Every hook has three parts; a name, an implementation, and a definition. The implementation consists of …

Continue reading

The PHP Future – PSR-7, Interoperability & Middleware

PSR-7 HTTP Message Interfaces HTTP messages are the foundation of web development. Web browsers and HTTP clients such as cURL create HTTP request messages that are sent to a web server, which provides an HTTP response message. Server-side code receives an HTTP request message, and returns an HTTP response message. HTTP messages are typically abstracted …

Continue reading

Understanding Dependency Injection

Dependency injection and dependency injection containers are different things: dependency injection is a method for writing better code a container is a tool to help injecting dependencies You don’t need a container to do dependency injection. However a container can help you. PHP-DI is about this: making dependency injection more practical.   The theory Classic …

Continue reading