{"id":29077,"date":"2018-12-10T13:48:12","date_gmt":"2018-12-10T11:48:12","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=29077"},"modified":"2018-12-10T13:48:19","modified_gmt":"2018-12-10T11:48:19","slug":"spatie-period-complex-period-comparisons-in-php","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2018\/12\/10\/spatie-period-complex-period-comparisons-in-php\/","title":{"rendered":"spatie\/period &#8211; complex period comparisons in PHP"},"content":{"rendered":"<!-- google_ad_section_start -->\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/spatie\/period\">spatie\/period<\/a> is a PHP library that provides complex period comparisons.\u00a0 It implements a variety of methods for calculating gaps, boundaries, overlaps, and other operations on multiple dates.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>spatie\/period is a PHP library that provides complex period comparisons.\u00a0 It implements a variety of methods for calculating gaps, boundaries, overlaps, and other operations on multiple dates.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_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},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[442,38,1330],"keyring_services":[],"class_list":["post-29077","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-calendar","tag-php","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":28970,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/11\/12\/spatie-data-transfer-object-data-transfer-objects-with-batteries-included\/","url_meta":{"origin":29077,"position":0},"title":"spatie\/data-transfer-object &#8211; Data transfer objects with batteries included","author":"Leonid Mamchenkov","date":"November 12, 2018","format":false,"excerpt":"spatie\/data-transfer-object library provides very easy to use data-transfer objects for PHP.\u00a0 If you code is relying a lot on arrays, you'll appreciate this different approach.\u00a0 And the more complex your arrays are, the more benefit you'll get out of it.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28215,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/11\/13\/easily-optimize-images-using-php\/","url_meta":{"origin":29077,"position":1},"title":"Easily optimize images using PHP","author":"Leonid Mamchenkov","date":"November 13, 2017","format":false,"excerpt":"Via this blog post I came across this PHP image optimization library, which somewhat reminds me of this blog post from a couple of years ago.\u00a0 As good as ImageMagick is, it takes time and effort to find all the right options.\u00a0 With Spatie Image Optimizer you have an almost\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":29035,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/11\/27\/avoid-complex-arrays-in-php\/","url_meta":{"origin":29077,"position":2},"title":"Avoid complex arrays in PHP","author":"Leonid Mamchenkov","date":"November 27, 2018","format":false,"excerpt":"Now that PHP 7+ sorted out a whole bunch of problems with type-hinting of parameters, return values, variables and properties, we turn our attention to somewhat deeper issues. Array is a native citizen in PHP.\u00a0 Arrays are very convenient and are widely used.\u00a0 However, if you stop and think about\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28653,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/06\/30\/php-jsonq-a-simple-elegant-php-package-to-query-over-any-type-of-json-data\/","url_meta":{"origin":29077,"position":3},"title":"php-jsonq &#8211; a simple, elegant PHP package to query over any type of JSON data","author":"Leonid Mamchenkov","date":"June 30, 2018","format":false,"excerpt":"php-jsonq provides an easy, yet powerful way to build queries for any JSON data (or PHP data structures for that matter, which are a step away).\u00a0 This has a variety of useful applications - data migration, API response filtering, complex configurations manipulation, and so on, and so forth.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28449,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/03\/26\/php-object-graph-visualizer\/","url_meta":{"origin":29077,"position":4},"title":"PHP object graph visualizer","author":"Leonid Mamchenkov","date":"March 26, 2018","format":false,"excerpt":"koriym\/print_o is an object graph visualizer for PHP.\u00a0 Here's a Wikipedia answer to the question of \"What is an object graph?\": Object-oriented applications contain complex webs of interrelated objects. Objects are linked to each other by one object either owning or containing another object or holding a reference to another\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/03\/object-graph-500x259.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":27434,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/20\/getting-started-with-workflows-in-php\/","url_meta":{"origin":29077,"position":5},"title":"Getting started with workflows in PHP","author":"Leonid Mamchenkov","date":"March 20, 2017","format":false,"excerpt":"For a large project at work, we need to integrate or develop a workflow engine. \u00a0I worked a little bit with workflow engines in the past, but the subject is way to big and complex for me to claim any expertise in it. So, I am looking at what's available\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2017\/03\/BPMN.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/29077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=29077"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/29077\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=29077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=29077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=29077"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=29077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}