Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

spyworld's avatar

Upgrade Laravel 4.2 to Laravel 5 for large application

How many days are needed to upgrade from Laravel 4.2 to Laravel 5 for a large complex application? My application has more than 150 models, 500 views, and 160 controllers. What should be the focus for upgrading? I'm planning a combination of PSR-0 & PSR-4. When upgrading, all the development will continue throughout the upgrading process.

0 likes
12 replies
spyworld's avatar

Will 3 months be enough time to upgrade to Laravel 5? 8 hours x 25 days x 3 months = 600 hours. Should that be enough?

Tray2's avatar

@spyworld Perhaps, but then you still need to upgrade to Laravel 11, if you want it done faster use Laravel shift.

jlrdw's avatar

@spyworld another option is start a new laravel 11 project and start migrating your code to the new app. But just a suggestion.

1 like
spyworld's avatar

According to our vendor, it would take about a year to upgrade to Laravel 10.

I can't use Laravel Shift for upgrading or migrating to the new app because of the initial design structure.

	//4,500 lines
    public static function payrollprocess() {
		global $trxdate_from, $info_location, $info_employee, $info_emp_stat_latest, $info_attendancetype, $info_public_holiday, $info_rest_day;
		global $info_grp, $info_emp_leave_list, $info_work_entry, $info_worker_entry, $info_worker_entry_manager, $info_car_entry, $info_upload_a;
		global $info_upload_b, $info_tax, $info_pay, $info_emp_awol;
		global $info_constant, $info_atvt, $info_contractor, $info_position_grouping, $info_position;
		global $info_attendance, $info_batch, $info_io, $info_cc, $info_tick;
		global $leavecode_secondment, $info_borrow, $info_gl;
		global $achieve, $month_manager_tier_arr, $atvt_supervision;
		global $info_managerincded, $info_interval, $info_grp_period;
        global $grpInv, $info_cc_number, $info_company;
	public static function get_performance($companyid, $year, $month) {
		$trx_yearmonth = Helpers::generate_year_month_int($year, $month);
		$location_arr = Location::where('companyid',$companyid)->where('actionflag','ACTIVE')->lists('locationid','locationid');

		$info = array();

		$temp = DB::table('performance as t1')
				  ->selectRaw('t1.*, t2.salarycode,, t3.glcode')
				  ->join('a as t2','t1.salaryheadid','=','t2.id')                                              
				  ->whereIn('t1.locationid',$location_arr)          
				  ->whereRaw("DATE_FORMAT(t1.start, '%Y%m')<='".$trx_yearmonth."'") 
				  ->whereRaw("DATE_FORMAT(t1.end, '%Y%m')>='".$trx_yearmonth."'")
				  ->where('t1.actionflag','ACTIVE')
				  ->get();
		$temp = json_decode(json_encode($temp), true);

		if (count($temp) > 0) {
			foreach ($temp as $val) {
				$info[$val['locationid']][$val['employeeid']][$val['id']]['start'] = $val['start'];
				$info[$val['locationid']][$val['employeeid']][$val['id']]['end'] = $val['end'];
				$info[$val['locationid']][$val['employeeid']][$val['id']]['salarycode'] = $val['salarycode'];
				$info[$val['locationid']][$val['employeeid']][$val['id']]['glcode'] = $val['glcode'];
			}
		}

		return $info;
	}
martinbean's avatar

@spyworld Why? You should not have /public in your URLs. That suggests your entire application—including sensitive files—is web-accessible.

spyworld's avatar

@martinbean I had a nightmare with the code. Inside the config code

	'sys_foldername' => 'SYS1',
	'sys_url' => '/SYS1/public',
	'web_url' => 'http://127.0.0.1/SYS1/public',
martinbean's avatar

@spyworld I have no idea what you’re trying to show me. Laravel does not have “sys” folders, so that looks like custom code.

spyworld's avatar

I plan to try using Laravel Shift first. If that doesn't work, I will combine PSR-0 and PSR-4 and perform a temporary upgrade to Laravel 5. However, we can't update directly to Laravel 11 due to the PHP version.

spyworld's avatar

I need to refactor my application because many functions don't make sense at all.

public static function current_app_timestamp() {
        $secs = date("s");
        $mins= date("i");
        $hours = date("H");
        $day = date("d");
        $month = date("m");
        $year = date("Y");
        $datetime =  mktime ($hours,$mins,$secs,$month,$day,$year);
        return $datetime;
    }
public static function fnDayText($val,$fulltext='y') {
        if($val == "1") {
            if ($fulltext=='y')
                $day = Lang::get('common.monday');
            else
                $day = Lang::get('common.monday_short');
        } elseif($val == "2") {
            if ($fulltext=='y')
                $day = Lang::get('common.tuesday');
            else
                $day = Lang::get('common.tuesday_short');
        return $day;
    }

Please or to participate in this conversation.