- FEATURES
- Autoload
- Class Reflection
- Magic Methods
- Exceptions
- Late Static Binding
- Type Hinting
- SPL
- PHPUNIT
- PHAR
- COMPOSER
- Carbon
- Guzzle
- Faker
- Math
- Requests
- DESIGN PATTERNS
- Singleton Pattern
- Observer Pattern
- Strategy Pattern
- Dependency Injection
- Middleware
- Registry
- SYMFONY
- Routes
- Annotations
- Flex
- Controllers
- Doctrine
- Templating
- VERSIONS
- Php7.4
- Php8.0
- SECURITY
- Filter Input
- Remote Code Injection
- Sql Injection
- Session Fixation
- File Uploads
- Cross Site Scripting
- Spoofed Forms
- CSRF
- Session Hijacking
- MODERN PHP
- Composer
- Autoloader
- Package
- Releases
- Generators
- Dependency Injection
- Middleware
- CUSTOM FRAMEWORK
- App
- Http Foundation
- Front Controller
- Routing
- Render Controller
- Resolver
- SoC
- FRAMEWORKS
- Slim
- Symfony V5
- Laravel V8
- Laminas V3
-
Codeigniter V4
Codeigniter
Appstarter Project Version: Codeigniter v4.1 Requirements: php extensions
php --ini #check php.ini in use
sudo gedit /etc/php/7.4/apache2/php.ini
sudo gedit /etc/php/8.0/apache2/php.ini
extension=curl
extension=intl
extension=mbstring
sudo service apache2 restart
Create new appstarter project
Update composer dependencies and set writable folder permisions.
cd /var/www/tests.local/php/codeigniter/
composer create-project codeigniter4/appstarter myproject
cd myproject/
composer update --ignore-platform-reqs
sudo chown -R $USER.www-data writable
http://tests.local/php/codeigniter/myproject/public/
# Welcome page Codeigniter
Routes
Add new route for Pages. Add controller and view template. For debugging you need to enable development environment.
// app/Config/Routes.php
...
$routes->get('/', 'Home::index');
$routes->get('(:any)', 'Pages::view/$1');
// app/Controllers/Page.php
namespace App\Controllers;
class Page extends BaseController
{
public function index()
{
return view('welcome_message');
}
public function view($id)
{
$data = array();
$data['id'] = $id;
return view('page/view', $data);
}
}
// app/Views/page/show.php
<h1>Page <?= esc($id) ?></h1>
// Copy env file -> .env
CI_ENVIRONMENT = development
It works!
http://tests.local/php/codeigniter/myproject/public/page/3
# Page 3
Last update: 531 days ago