- This is server side Scripting-launguage
- use Build dynamic web pages
- Run on Server
- Use for - Speed, Simplicity , Flexibility
- PHP first name - Personal Home Page Then > PHP Hypertext Preprocessor
Notes
Php contains html , css,js. php
For comment use ”//” or ” /**/ “
Import tags
” - and PHP
echo - Returns multiple string
Print - return single String and return value
Variables
IMP
collapsed:: true
$_GET = Data Is appended To the URL , Not SECURE , char Limit , Bookmark Is possible w/ value , Better for search page - Technically it array
$_POST = Data is packaged inside the body of the HTTP request , MORE SECURE , No data limit , Cannot bookmark , GET request are not cached , Better
collapsed:: true
for submitting credentials
You can catch data for more conveniat use
collapsed:: true
Opraters
Arithmetic operators
collapsed:: true
collapsed:: true
// Arithmetic$sum = 1 + 1; // 2$difference = 2 - 1; // 1$product = 2 * 2; // 4$quotient = 2 / 1; // 2// Shorthand arithmetic$num = 0;$num += 1; // Increment $num by 1echo $num++; // Prints 1 (increments after evaluation)echo ++$num; // Prints 3 (increments before evaluation)$num /= $float; // Divide and assign the quotient to $num
perenthisis
collapsed:: true
() > ** > * > / > % > + > -
Logical op
if - else statement
Switch - Statement
collapsed:: true
Loops
For loop
While loop
collapsed:: true
Do while loop
Foreach loop
collapsed:: true
Array
Math Operations
Funtions
This use for make code block Run particular time
We don’t need Re-write code just call it
String Methods
Privent atteck - Filter methods
collapsed:: true
include() - copies the content of a file (php/html/text) and inclued in PHP File.
collapsed:: true
use for Code resubility like header , Fotter
cookie() - Informstion about a user stored in a user’s Web-browser.
collapsed:: true
session
collapsed:: true
SGB used to store information on a user to be used across multiple pages.
A user is assigned a session-id
ex- login credentials
This is useful for pass data in global
Server
collapsed:: true
SGB That contains headers, paths, and script locations
THE entries in this array are created by the wev server.
$_SERVER - use this
hashing
collapsed:: true
this is method to pass sensitive data in
this useful for atteck
trafring sesitive data into letters, numbers and/or symbols via a methematical process.
connet to mySQL
collapsed:: true
There are 2 Type to connet
collapsed:: true
MySQLi Extension
logseq.order-list-type:: number
PDO (PHP Data Objects )
logseq.order-list-type:: number
logseq.order-list-type:: number
Libs & Framework
Laravel: A modern, MVC-based PHP framework with built-in tools for routing, authentication, ORM, and task scheduling. Highly favored for its elegant syntax and developer-friendly ecosystem.
Symfony: A robust and flexible PHP framework for large-scale enterprise applications. It’s known for its reusable components, stability, and widespread use in the PHP community.
CodeIgniter: A lightweight, fast, and simple PHP framework for building dynamic web applications. Ideal for beginners or when you need to get projects up and running quickly.
Yii: A high-performance, component-based PHP framework that is perfect for developing large-scale applications. It comes with built-in features like caching, authentication, and security.
Zend Framework (Laminas): A professional PHP framework that offers a set of reusable components and libraries. It’s ideal for enterprise-grade applications and services.
Composer: The PHP dependency manager that makes it easy to manage libraries and packages. It’s essential for managing project dependencies in modern PHP development.
PHPMailer: A library for sending emails from PHP, with support for attachments, HTML messages, SMTP authentication, and more.
Guzzle: A powerful HTTP client for PHP, ideal for making HTTP requests to APIs or web services. It supports synchronous and asynchronous requests.
Monolog: A comprehensive logging library for PHP, allowing you to log messages to various handlers (files, databases, email, etc.) in a standardized format.
Carbon: A popular PHP date and time library that extends PHP’s native DateTime class with a wide range of useful methods for date manipulation and formatting.
Twig:A flexible, fast, and secure templating engine for PHP, designed to separate the logic of your application from the presentation layer.
Intervention Image: A simple and easy-to-use image handling and manipulation library for PHP, with support for resizing, cropping, filters, and more.
Doctrine ORM: A powerful and flexible Object-Relational Mapping (ORM) library for PHP, used to map database entities to PHP objects, easing database interaction.
PHPUnit: A testing framework for PHP that helps developers write unit tests and perform test-driven development (TDD). It supports assertions, mocking, and code coverage analysis.
Slim: A lightweight micro-framework for PHP that is perfect for building small and simple RESTful APIs or web applications. It focuses on simplicity and performance.
Lumen: A micro-framework by the creators of Laravel, designed for building fast and lightweight APIs. It uses the same core components as Laravel but with less overhead.
Firebase PHP SDK : A library to integrate Firebase services (such as Firestore, Authentication, and Push Notifications) with your PHP applications.
JWT (Firebase JWT): A simple PHP library for working with JSON Web Tokens (JWT), often used for authentication and secure data transmission in APIs.
PHPStan: A static analysis tool for PHP that helps find bugs in your code without running it. It checks for type safety, dead code, and potential issues in your codebase.
Xdebug: A PHP extension for debugging and profiling. It allows you to step through your code, inspect variables, and trace execution flow to make development easier.
Ratchet: A PHP WebSocket library for real-time, bi-directional communication between the server and client. It supports websockets and provides a framework for building chat systems or live data feeds.
Flysystem: A filesystem abstraction library for PHP, enabling you to work with different storage systems (local, Amazon S3, FTP, etc.) using a unified API.
Faker: A library for generating fake data in PHP, useful for testing, seeding databases, or populating forms with realistic data.
More learn
Explore the following links for valuable resources, communities, and tools to enhance your skills :-