{"id":1940,"date":"2016-08-10T09:04:27","date_gmt":"2016-08-10T07:04:27","guid":{"rendered":"https:\/\/guven.atbakan.com\/blog\/?p=1940"},"modified":"2024-04-14T00:26:10","modified_gmt":"2024-04-13T21:26:10","slug":"running-laravel4-with-php7","status":"publish","type":"post","link":"https:\/\/guven.atbakan.com\/blog\/running-laravel4-with-php7\/","title":{"rendered":"Running Laravel4 with PHP7"},"content":{"rendered":"<p>I will not argue about Laravel&#8217;s shitty versioning system and dropping support for older versions. They are so excited, everyday adding a new feature to framework&#8217;s core. Yeah, thats really good thing but who cares fucking backward compability?<\/p>\n<p>Anyway, if you are using Laravel4 and want to run it with PHP7, you have make some changes on framework&#8217;s core. So, you need to fork L4 and publish it as a new package OR (preferred) you need to use it as custom repository.<\/p>\n<p>So, what do you need to change?<\/p>\n<p>Here is a pull request, that contains full change for support PHP7: <a href=\"https:\/\/github.com\/laravel\/framework\/pull\/13338\">https:\/\/github.com\/laravel\/framework\/pull\/13338 <\/a><\/p>\n<p><a class=\"author pull-header-username css-truncate css-truncate-target expandable\" href=\"https:\/\/github.com\/kampernet\">kampernet <\/a>changed Exception object references to Throwable because PHP7 uses Error instead of Exception. So, referencing as Throwable is a good idea.<\/p>\n<p>So what i did? Here: <a href=\"https:\/\/github.com\/shibby\/laravel-framework\/commit\/1ab51571fde84b31d7328e9b9c86033d390187bf\">https:\/\/github.com\/shibby\/laravel-framework\/commit\/1ab51571fde84b31d7328e9b9c86033d390187bf<\/a><\/p>\n<p>Just deleted Exception references on functions. I&#8217;m using my repository for projects that runs with PHP7. So, you can use it if you want with your own responsibility. And you have to watch security\/critical fixes on Laravel&#8217;s 4.2 branch.<\/p>\n<p>If you want to use this repository, you need to make some changes on your composer.json file.<\/p>\n<p>First, i added <strong><code>\"php\":\"&gt;=\"7.0\",<\/code><\/strong> to my require section.<\/p>\n<p>And, second, i added my repository as custom repository above require section:<\/p>\n<pre class=\"code highlight\"><code><span id=\"LC9\" class=\"line\"><span class=\"nt\">\"repositories\"<\/span><span class=\"p\">:<\/span> <span class=\"p\">[<\/span><\/span>\r\n<span id=\"LC10\" class=\"line\">    <span class=\"p\">{<\/span><\/span>\r\n<span id=\"LC11\" class=\"line\">      <span class=\"nt\">\"type\"<\/span><span class=\"p\">:<\/span> <span class=\"s2\">\"vcs\"<\/span><span class=\"p\">,<\/span><\/span>\r\n<span id=\"LC12\" class=\"line\">      <span class=\"nt\">\"url\"<\/span><span class=\"p\">:<\/span> <span class=\"s2\">\"https:\/\/github.com\/shibby\/laravel-framework.git\"<\/span><\/span>\r\n<span id=\"LC13\" class=\"line\">    <span class=\"p\">}<\/span><\/span>\r\n<span id=\"LC14\" class=\"line\">  <span class=\"p\">],<\/span><\/span><\/code><\/pre>\n<p>But i think i need to delete other branches on my fork for make composer&#8217;s resolution faster. I&#8217;m waiting for your ideas. Maybe we can move as a group? At last, i will upgrade my 4.2 project to latest(or lts) version. I want to do it with less pain. It hurts now :(<\/p>\n<p>Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I will not argue about Laravel&#8217;s shitty versioning system and dropping support for older versions. They are so excited, everyday adding a new feature to framework&#8217;s core. Yeah, thats really good thing but who cares fucking backward compability? Anyway, if you are using Laravel4 and want to run it with PHP7, you have make some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[763],"tags":[781,783,785,787,789],"class_list":["post-1940","post","type-post","status-publish","format-standard","hentry","category-development-and-internet","tag-laravel4-en","tag-laravel4-and-php7-en","tag-laravel4-php7-en","tag-laravel4-2-en","tag-laravel4-2-and-php7-en"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/posts\/1940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/comments?post=1940"}],"version-history":[{"count":5,"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/posts\/1940\/revisions"}],"predecessor-version":[{"id":1948,"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/posts\/1940\/revisions\/1948"}],"wp:attachment":[{"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/media?parent=1940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/categories?post=1940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guven.atbakan.com\/blog\/wp-json\/wp\/v2\/tags?post=1940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}