I wasn't sure if you were requesting an IDE or an MVC framework, but I wanted to share a new MVC for PHP that is very close to .NET.
https://github.com/DominicArchual/Php-One
Here's how it works:
Define your view model:
require_once('bin/System.php'); class MovieViewModel { public $Id = 0; public $Title = ""; public $Rating = ''; public $ReleaseDate = ''; public function __construct($id, $title, $rating, $releaseDate) { $this->Id = $id; $this->Title = $title; $this->Rating = $rating; $this->ReleaseDate = $releaseDate; } }
Define your controller:
require_once('/repositories/MovieRepository.php'); require_once('/models/MovieViewModel.php'); class HomeController { public $MovieRepo; public function __construct() { $this->MovieRepo = new MovieRepository(); // create an instance of our repo } public function Index() { $model = []; // create a variable to store our movies (don't actually need this, but it's nice) $movies = $this->MovieRepo->GetMovies(); // get data from our repo // do some transformations and populate our view model foreach ($movies as $movie) { $model[] = new MovieViewModel( $movie->Id, $movie->Title, $movie->IsRRated ? 'R' : 'PG', $movie->ReleaseDate->format('F jS, Y') ); } View::Render('views/home/index.php', null, $model); // call our view and send the model } }
Define your view:
<ul class="list-group"> <?php foreach($Model as $movie) { echo <<<HTML <li class="list-group-item"> <strong>{$movie->Title}</strong> ({$movie->Rating}) - {$movie->ReleaseDate} </li> HTML; } ?> </ul>
And, presto!
