Web Assets (Images, JavaScript, CSS Files)

Assets are front end and static files such as CSS stylesheets, JavaScript files, images and similar.

There are multiple approaches you can check out when working with these files in your PHP application.

Handling these files usually includes installation from 3rd party location (GitHub), and copying the required files to your publicly accessible folder, such as web, public_html and similar.

After installation you usually also want to minimize JavaScript and CSS files.

For images maybe you need to create favicons for multiple devices from source logo of the website and similar.

Many developers also use approach of developing a project with two separate repositories - one for back end (PHP application) and one for front end.

The API points in the back end part are connected with the front end. Maintaining and scaling to application requirements can be much easier.

Content Delivery Network (CDN)

High traffic and complex sites many times also create a separated CDN for serving these static files. This can improve the performance since the asset is downloaded only once from a separate location.

For many open source front end libraries, many times using a publicly available CDNs is advices since it reduces the required number of requests and traffic for your application.

See Also

GitHub OctocatFound a typo? Something wrong with this content? Just fork and edit it.

Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all the contributors.